You are here

function riddler_settings_validate in Captcha Riddler 6

Same name and namespace in other branches
  1. 7 riddler.module \riddler_settings_validate()
1 string reference to 'riddler_settings_validate'
riddler_settings in ./riddler.module

File

./riddler.module, line 120
Adds a question and answer type to the Captcha module.

Code

function riddler_settings_validate($form, &$form_state) {
  $i = 0;
  while (array_key_exists('riddler_question_' . $i, $form_state['values'])) {
    if ($form_state['values']['riddler_question_' . $i] != '' && $form_state['values']['riddler_answer_' . $i] == '') {
      form_set_error('riddler_answer_' . $i, t('Group !i is incomplete (answer is missing).', array(
        '!i' => $i + 1,
      )));
    }
    if ($form_state['values']['riddler_question_' . $i] == '' && $form_state['values']['riddler_answer_' . $i] != '') {
      form_set_error('riddler_question_' . $i, t('Group !i is incomplete (question is missing).', array(
        '!i' => $i + 1,
      )));
    }
    $i++;
  }
}