Form Validation - Description

This script defines a number of functions that allow common form data validations to be performed. Among them are:

Other functions also strip spaces or illegal keyboard characters from form data.

Script Engine / Document Object Model Required

( Javascript 1.1 | JScript 2.0 | ECMAScript 1.0 ) & DOM 0

Modification History




Added trimWhitespace() function.

2001/01/04 v1.0

Added the ability to check for the validity of individual credit card types to isValidCreditCard().

2002/04/19 v1.0.1

Added a stricter email address check (the original test is still available).

2002/06/13 v1.1.0

Added a generic form validation function and support for 9 digit zipcodes.

2002/06/24 v1.1.1

Added fix for IE bug where dropdowns have a non-standard identifier.

2002/07/02 v1.1.2

Added phone number validation.

2002/07/08 v1.1.3

Added a check for <select> options with an empty value to the generic form validation function.

2002/07/09 v1.1.4

Bug fix for yesterday's addition.

2002/10/29 v1.1.5

Changed email validation to use a Regex; fixed radio button checking (thanks Steve).

2002/11/20 v1.1.6

Fixed phone number check (thanks Mark).

2004/03/19 v1.1.7

Fixed multiple radio group validation and repeated validation (thanks W Dean).

2004/04/07 v1.1.8

Better radio group validation and fixed example page for same (thanks Vincent).

More about this script

Related to this script


This script is released under a Creative Commons License.