You are here

function lost_character_captcha_settings_form_validate in CAPTCHA Pack 5

Same name and namespace in other branches
  1. 6 text_captcha/lost_character_captcha/lost_character_captcha.admin.inc \lost_character_captcha_settings_form_validate()
  2. 7 text_captcha/lost_character_captcha/lost_character_captcha.admin.inc \lost_character_captcha_settings_form_validate()

Validation function for the settings form

File

text_captcha/lost_character_captcha/lost_character_captcha.module, line 81

Code

function lost_character_captcha_settings_form_validate($form_id, $form_values) {
  if ($form_id == 'lost_character_captcha_settings_form') {
    $lost_quantity = (int) $form_values['lost_character_captcha_quantity'];
    $hinting = (int) $form_values['lost_character_captcha_enable_hint'];
    $min_length = 3 + 2 * $lost_quantity + (1 - $hinting);

    // check the number of words in the pool
    _text_captcha_word_pool_validate('lost_character_captcha_word_pool', $form_values, 3, $min_length, 'The following words are too short (at least @minimum_length characters needed for the current settings of characters to lose and hinting): <div>@words</div>');
  }
}