Posted by lussoluca on January 17, 2012 at 1:31pm
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
Project Information
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: JavaScript Utilities, Third-party Integration
- Reported installs: 7 sites currently report using this module. View usage statistics.
- Downloads: 75
- Last modified: January 17, 2012