jQuery Walidate
The jQuery Form-Validation-Plugin where the Form-HTML-Markup doesn't matter!
by Michael Fischer
10.5kBDownload jQuery Walidate
(compressed + minified)
45.2kBDownload source
(development version)
Try it on jsFiddle.net!
(examples)
Features
- Works on every HTML-Form without changing your existing Form-HTML-Markup
Perfect for dynamically created forms via CMS-Systems or extensions and
100% individual forms.
- Lots of callback-functionalities.
E.g.: Function-call for valid/invalid user-inputs for each element, individual function-calls for the submit button and callbacks after form or element initialization.
- Easy to implement, no- really.
For example (mark an element as required): $(selector).walidate('validate'); or
Check with RegEx: $(selector).walidate('validate', { expression: /^[a-zA-Z]{3,}$/ });
- Feature rich options:
- You can use regular expressions to verify text-values
- define individual event-handlers for each element
- callback-functions for valid and invalid user-inputs for every element and for the submit-button (individual function-call if everything's valid or sth is invalid)
- define allowed and prohibited values/selections
- define default values for any element
- define verify-fields (e.g. to validate e-mails or passwords twice) as much as you want
- It's designed to be as simple as possible
The basics
This plugin adds and removes CSS-classes to mark each element as required, valid, invalid and every element that has to be validated.
The default classes used are:
.validate for each element that has to be validated
.required for required elements
.valid for valid user-inputs/-elements or selections
.error for invalid user-inputs/-elements or selections
.compare-x for elements with an additional verify-field
- Initialize the form:
$('form').walidate();
- or initialize the form and change the default plugin properties:
$('form').walidate({
// your properties
}callback);
- Set an element as a required input:
$(selector).walidate('validate');
- or add properties to this element:
$(selector).walidate('validate', {
// additional properties
}callback);
Documentation - Reference
Live demo
View on jsFiddle
6 Donate
I would appreciate a beer from you!
License
This plugin is distributed under the MIT and GPL licenses.
You're allowed to use this plugin in any commercial and non-commercial project.
Contact
dotwin[a.t.]gmx[d.o.t.]net