You are here

function trick_question_form_validate in Trick Question 7

Same name and namespace in other branches
  1. 6 trick_question.module \trick_question_form_validate()

Hook validate

1 string reference to 'trick_question_form_validate'
trick_question_form_alter in ./trick_question.module
Alter the forms and add our field

File

./trick_question.module, line 182
trick_question.module - Main file for trick question module

Code

function trick_question_form_validate($form, &$form_state) {

  // Check answer, ignore case
  if (drupal_strtolower($form_state['values']['trick_question']) != drupal_strtolower(variable_get('trick_question_answer', md5(time())))) {

    // Set form error for our field, let Drupal handle the rest
    form_set_error('trick_question', t('You must answer the trick question correctly.'));
  }
}