Validation: Validate form inputs according to the CSS class

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 69%Total: 483 All time: 62 This week: 3Up
Version License JavaScript version Categories
validation 1.0BSD License1.0Validation, jQuery
Description Author

This object can validate form inputs according to the CSS class.

It uses the jQuery library to traverse the list of inputs of a form and performs validations of types defined in the CSS class attribute of each input.

Currently it supports validations of types: required, email, date, time currency, numeric, alphanumeric, alphabetic, state, zip code and URL.

If the fields are invalid an error message is displayed inside a page element for displaying validation errors.

Picture of Larry Wakeman
Name: Larry Wakeman <contact>
Classes: 1 package by
Country: United States United States
Age: 71
All time rank: 515 in United States United States
Week rank: 6 Up2 in United States United States Up

Details
This script can be used to validate a form or a control. This script requires jQuery. To load this script, use the following: <script language="JavaScript" src="validation.js"></script> <script language="JavaScript"> var valid = new validate(); </script> The form definitions should be as follows: <form method="POST" action="targetPage" name="FormName" id="FormName" onsubmit="return valid.validateForm(this);"> Items to be validated should be described as follows: <label for="FacilityState">Facility State</label> <input type="text" name="FacilityState" id="FacilityState" class="a list of validations and other classes" size="3" onchange="javascript: valid.validateInput(this);"> <div id="FacilityStateError" class="validationError" style="display:none;"></div> You might be able to use onblur events but if you display a popup, that gets to be problematic and by default, this script creates a popup. You can also put a div as follows on your page to display any validation errors from the form: <div id="ValidationError" class="validationError" style="display: none;"></div> Valid validations are: required email date - in dd-mon-yyyy, dd-mm-yyyy, yyyy-mon-dd or yyyy-mm-dd formats time currency numeric alphanumeric alpha phone state zipcode urlentry Valid controls are: text testarea select - Required only, value not '' or 0 radio buttons - one must be checked
  Files folder image Files  
File Role Description
Accessible without login Plain text file index.htm Example Example
Accessible without login Plain text file readme.txt Doc. readme
Plain text file validation.js Class validation class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:483
This week:0
All time:62
This week:3Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:66%StarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:69%StarStarStarStar
Rank:17