yav - javascript validation tool
Home
Download
|
Support
Documentation
Getting started
Validation rules
Multi-language support
Learn by example
Simple registration form
Notification of changes
Newsletter Sign-up
Captcha
The andor-operator
Pre/Post/Implies rules
Working with the masks
Custom validation
Support
Discussion group
Mailing list
E-mail contact
Example 5
This is an advanced example using the andor-operator.
Note that in some circumstances the error message is not linked to a particular field,
so Yav automatically uses the default position (i.e. the
errorsDiv
element).
source
var rules=new Array(); rules[0]='number:a number|required'; rules[1]='number|equal|1000|andor-operator'; rules[2]='number|numeric|andor-operator'; rules[3]='number|minlength|6|andor-operator'; rules[4]='number|maxlength|6|andor-operator'; rules[5]='2|and|3-4|andor-operator'; rules[6]='1|or|5|Your number must be a numeric (6 digits) OR the specific number 101.';
Advanced Example using the andor-operator
This field only accepts numbers with 6 digits or the number '101'.
Your number:
Copyright 2005-2008. All rights reserved.