validator: Validate form input values according to rules

Recommend this page to a friend!
     
  Info   Example   View files Files   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 81 All time: 458 This week: 3Up
Version License JavaScript version Categories
validator 1.0GNU Free Document...5Validation, jQuery, Forms, EcmaScript 6
Description 

Author

This class can validate form input values according to rules.

This takes an array of properties that define rules for validating different inputs of form on a HTML page.

The class can validate the form with the given rules as result of an event like the form submission.

Picture of Peter Taiwo
  Performance   Level  
Name: Peter Taiwo <contact>
Classes: 1 package by
Country: South Africa South Africa
Age: 27
All time rank: 1691 in South Africa South Africa
Week rank: 6 Up1 in South Africa South Africa Equal

Example

<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form class="form" name="form"> <input type="text" class="name" name=""> <span class="validator-error-span"></span> <input type="password" class="password" name=""> <span class="validator-error-span"></span> <input type="text" class="email" name=""> <span class="validator-error-span"></span> <input type="submit" value="Send" name=""> </form> <script type="text/javascript" src="../jquery/jquery.js"></script> <script type="text/javascript" src="validator.js"></script> <script type="text/javascript"> var validator = new Validator('form').configure( [ { required: true, input: '.name', errorType: 'default', minLength: 5, match: new RegExp(/^[a-z]/) }, { input: '.password', required: true, errorType: 'default' }, { input: '.email', required: true, errorType: 'default' } ], ).onFormSubmit(function(form) { validator.log(form); }).validate(); </script> </body> </html>

  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file index.html Example Example
Plain text file validator.js Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:81
This week:0
All time:458
This week:3Up