First, download the Java Script form validation script here.
Validating form input with Java Script is easy to do and can save a lot of unnecessary calls to the server as all processing is handled by the web browser.
It can prevent people from leaving fields blank, from entering too little or too much or from using invalid characters.
The script has a catalog of almost all the common validation types built-in.
The idea is to create a set of “validation descriptors” associated with each element in a form.
To find out which value (if any) has been selected, you need to loop through the array until you find which one has been selected: In the case of a single radio button we have nothing to loop through so just return either it's value, if the radio button is checked, or false.The “validation descriptor” is nothing but a string specifying the type of validation to be performed.Each field in the form can have zero one or more validations. More info & downloads where Do My Validation One() and Do My Validation Two() are custom functions for validation.In other words if the first condition fails, the second condition will not be tested and so forth.Only when all conditions have been satisfied do we reach the command, in which case the form will be submitted.