Validate.js

A powerful generic form validator.
1.99, 2005-09-22
1.99 2005-09-22

Various fixes, most notably a fix for invisible required fields submitted by Ben Balzarini.

1.98 2005-04-25

requireLength no longer requires a value (that is the job of requireValue).

1.97 2005-02-10

Added formChanged function, and optional form argument to formFocus.

1.91 2004-12-23

Remedial undefined check for Mac IE (Microsoft's joke on the Mac community).

1.9 2004-11-25
  • Fields are now referred to by label text using fieldname, if available, rather than field name. This should make it more obvious to the user which field is invalid.

  • Added requireConfirmation function, useful for fields that require double entry (like passwords or email addresses).

1.82 2004-09-14

Fix to catch phony/example addresses.

1.81 2004-09-13

Email addresses ending in example.com, example.net, and example.org are now recognized as phony by checkEmail.

1.8 2004-07-02
  • Multiple digit separators are now removed by fixFixed, fixFloat, fixInt, and fixMoney.

1.7 2004-02-21
  • fixCreditCard is now aware of Visa®, MasterCard®, American Express®, and Discover® card numbers. It will still work for others, but these brands will be tested more stringently for their correct number of digits (as provided by Valid Credit Card Lengths and Prefixes on viacompras.com).

  • fixCreditCard now correctly computes the check digit for cards with an odd number of digits (American Express®, JCB®, and very old Visa® card numbers) by working right to left as required by the algorithm.

1.6 2004-01-17
  • Fixed checkIntRange and checkFloatRange functions.

  • Disabled fields are no longer validated.

  • Added dependants function.

1.54 2004-01-16
  • Added checkIntRange and checkFloatRange functions.

1.53 2003-10-28
  • fixPhone now accepts a parameter to ignore extensions.

1.52 2003-10-26
  • fixPhone now parses extensions.

1.51 2003-09-08
  • requireRadio now checks to ensure a value is selected only if there is a visible option.

1.5 2003-08-01
  • Added fixTime24 to validate 24-hour time entry.

  • Added fixCreditCard to validate credit card number check digits.

  • Fixed fixSSN.

1.4 2003-06-12
  • Added sep parameter to numeric functions, to allow tolerance of digit grouping characters (i.e. commas).

1.31 2003-02-19
  • Added an exclusion for non-input form element loops. Apparently some UAs consider fieldset to be form elements.

1.3 2003-02-13
  • Removed user agent check in favor of more accurate feature exploration: canCheckByBlur.

  • Fixed error language for requireLength.

1.23 2003-02-10
  • Fixed fixMoney and fixFixed. Both had trouble with small and negative numbers.

  • Better defined "blank" fields.

1.22 2003-01-30
  • Fixed autoCheckByClass function.

1.21 2002-11-12

Simplified word character list for email checking.

1.2 2002-11-06
  • Added requireChecked function to require checking checkboxes (for legal agreements, etc.).

  • Added requireRadio function, used internally by form checkers to ensure a radio button in the given group is checked.

  • Added requireLength function for establishing a minimum and/or maximum field length.

  • Added allowChars function for providing a list of acceptable characters for a field.

  • Added disallowChars function for providing a list of unacceptable characters for a field.

  • Added checkEmail function for simple email validation.

  • Added radio button checker; all form checking functions now require a radio button in each group to be checked.

  • Password fields may now be autochecked.

1.1 2002-04-15
  • Added checkClass function for class-checking individual elements.

  • Improved autocheck compatibility.

  • Improved fixTime and fixSSN compatibility (Netscape 4.x).

  • Removed defaultAreaCode global variable in favor of a new (optional) fixPhone parameter.

1.0 2001-06-19

Initial release.