Validatious 2.0

Easy form validation with unobtrusive JavaScript

Add validators to fields

Validators are added to fields by adding the validator names (or aliases) to the class name of input, select and textarea elements. Available validators can be found in the reference.

This will add the required validator to the field. Class names that does not correspond to validators (ie used for styling or other purposes) are silently ignored.

Prefixing class names

If you're experiencing trouble with validator names that conflict with your existing class names, or otherwise want to namespace Validatious validator names, you can configure a class name prefix using v2.Validator.prefix. More on configuring Validatious.

v2.Validator.prefix = 'v2_';

Now you can add validators like so:

Example

The following form uses a prefix to add its validators. See code below.


Next: Add validators with parameters | Back to HTML extension features index

© 2008 Christian Johansen. Validatious is licensed with a BSD License, documentation and site content with CC Attribution-Share Alike. About.