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:

<?php
[...]
'#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:

<?php
  $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

Downloads

Version Downloads Date Links
7.x-1.0 tar.gz (14.12 KB) | zip (15.07 KB) 2012-Jan-17 Notes

Project Information


Maintainers for Validate

  • lussoluca - 2 commits
    last: 18 weeks ago, first: 18 weeks ago

Issues for Validate

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports