File: readme.txt

Recommend this page to a friend!
  Classes of Larry Wakeman   Validation   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: readme
Class: Validation
Validate form inputs according to the CSS class
Author: By
Last change: Added support for selects (dropdowns) and radio buttons.
Date: 12 years ago
Size: 1,716 bytes
 

Contents

Class file image Download
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