jQuery Validaty - A Validation Plugin
jQuery Validaty is a form validation plugin.
Required Files
- jquery.validaty.css
- jquery.validaty.js
- jquery.validaty.validators.js
Options
balloon: true // Enables the balloon message or list message style. fade: true // Enables the fade on balloons message. focus: 'first' // Field to be focused when validation fails. errorTarget: undefined // Callback to intercept the errors. ignore: ':submit' // Fields to be ignored. speed: 200 // The speed of the fade option. validators: {} // Object to hold the validators functions.
Usage
Use the attribute data-validaty
to declare the validation you want.
<form> <input type="text" data-validaty="required" /> </form>
$('form').validaty();
Actions
Add the key on:
with the action you want to trigger the validation.
<form> <input type="text" data-validaty="required on:blur" /> </form>
Functions
$('form').validaty('helper'); // Gives you the internal helpers. $('form').validaty('validator'); // Gives you a validator. $('form').validaty('destroy'); // Destroy the Validaty's bind. $('form').validaty('validate', selectors); // Execute the validation over the form or the given selectors.
Validators.js
This file contains all validators and you can include your own. It was separated from jquery.validaty.js
to be more flexible and easy to edit and add more. By default it comes with the following validators:
- Contain
- Date ISO
- Digits
- Equal
- Max Check
- Max Length
- Max Select
- Min Check
- Min Length
- Min Select
- Number
- Range Length
- Range Number
- Required
- URL
- Username