Validate handler for the next button on first page.

Related topics

1 string reference to 'form_example_tutorial_8_next_validate'
form_example_tutorial_8 in form_example/form_example_tutorial.inc
Example 8: A simple multistep form with a Next and a Back button.

File

form_example/form_example_tutorial.inc, line 468
This is the Form API Tutorial from the handbook.

Code

function form_example_tutorial_8_next_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.'));
  }
}