This validation script offers a collection of validation functions, and an easy way to use them in your form with Java Script.
For some forms with only a few values it's easy to offer options via a select menu.
Here, data validation isn't as important because the only options given are the ones allowed.
For other data fields, like zip codes, listing all variations is impossible, so the easiest way is to use a text field.
This article discusses how to use Java Script to validate important types of form data, including names, addresses, URLs, email addresses, phone numbers, zip codes, expiration dates and credit card numbers (Visa, Master Card, Discover, and American Express, in both Canadian and US formats, with either 13, 14, 15 or 16 digit account numbers).
Each data validation function returns an array of valid inputs that were detected, and has the ability to filter and reformat data to desired appearances and standards.
If no valid input is detected, then an error code is returned.In addition to providing definitions for each error code number, the Java Script form validation script also provides associated human-readable error messages which explain the error after it has occurred.Also, a user input validation function is provided which stops falsified user information from being submitted to business Web sites.This function is easy to add to any Web form by creating a list of form objects, and registering the function as the event handler for the form.The programming logic allows for relations to be expressed between associated form fields when performing user input validation.For added flexibility, the validation process allows the form creator to permit specific data entry fields to contain unverified or unusual data at the time the form is successfully validated and submitted.