Validate is a wrapper for jquery.validate plugin. It's an API module and doesn't provide any UI. To use it add to your form API definition the property #validate as an array of validation rules:

[...]
'#validate' => array(
  'required' => array(true, t('Email address is required.')),
  'email' => array(true, t('Email is not valid.')),
  'remote' => array('check_existing_mail', t('This email address is already registered'))
)
[...]

To activate validation then add:

  $form['#client_validation'] = TRUE;

Validation happens in javascript and the form is submitted only when no error occurs.

You could use #validate property in a new form or hook into other forms with hook_form_alter.

For a complete list of all validation rules see: jquery.validate documentation

Credits

Sponsored by Wellnet

Project information

Releases