You are here

function captcha_questions_admin_settings_validate in Captcha Questions 7

Implements hook_validate().

File

./captcha_questions.admin.inc, line 141
Functionality and helper functions for Captcha questions administration.

Code

function captcha_questions_admin_settings_validate($form, &$form_state) {

  // If question is specified without answer, ask for answer.
  if (!empty($form_state['values']['captcha_questions_question']) && empty($form_state['values']['captcha_questions_answers'])) {
    form_set_error('captcha_questions_answer', t('Please provide an answer'));
  }

  // If answer given, but no question, ask for question.
  if (empty($form_state['values']['captcha_questions_question']) && !empty($form_state['values']['captcha_questions_answers'])) {
    form_set_error('captcha_questions_question', t('Please add a question'));
  }
}