multipage_form_example_custom_validate

Definition

multipage_form_example_custom_validate()
developer/examples/multipage_form_example.module, line 216

Description

Validate our form.

Code

<?php
function multipage_form_example_custom_validate() {
  global $form_values;
  // validate our number, but don't bother if the back button was hit
  if (($form_values['page'] ==  3 ) && !is_numeric($form_values['fav_number']) && ($_POST['op'] != t('Back'))) {
    form_set_error('fav_number', t('Favorite number is a <em>number</em>, dummy!'));
  }
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.