multipage_form_example_custom_validate

Versions
4.7 – 6
multipage_form_example_custom_validate()

Validate our form.

Code

developer/examples/multipage_form_example.module, line 216

<?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!'));
  }
}
?>
Login or register to post comments
 
 

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.