1 form_example_tutorial.inc form_example_tutorial_7_validate($form, &$form_state)

Validation function for form_example_tutorial_7().

File

modules/examples/form_example/form_example_tutorial.inc, line 314
This is the form API tutorial.

Code

function form_example_tutorial_7_validate($form, &$form_state) {
  $year_of_birth = $form_state['values']['year_of_birth'];
  if ($year_of_birth && ($year_of_birth < 1900 || $year_of_birth > 2000)) {
    form_set_error('year_of_birth', t('Enter a year between 1900 and 2000.'));
  }
}