JavaScript index pageHome

JavaScript Form Validation

Now the Serious Stuff

JavaScript form validation tries to ensure that the values entered into a form are correct before they are submitted to the server. While you can never ensure that all information is perfectly correct, you can at least catch obvious errors made by people who have JavaScript enabled browsers (Netscape Navigator and Microsoft Internet Explorer 3.0 and above). JavaScript validation can be especially useful in "mailto:" forms, which are usually not validation-processed by the server. In cases where the server is processing the form data with a CGI script, JavaScript validation can save the server from having to "waste resources" returning error messages itself, as well as save the user time waiting for the server to return those error messages.

Try some of the examples below.

Three Checkboxes

Try selecting fewer or more than three colors, then three colors exactly.

Red Green Yellow Blue Purple Orange Violet


Radio Buttons

First submit the form without making a selection, then with a selection.

Extra Large


Single Item Select List

First select nothing, then the month in which you were born.


Multiple Item Select List

Choose the two items in the list which best match the category animal, vegetable or mineral.

Note: You have to hold down your control (CTRL) key in order to make multiple selections with your mouse.

Remember to try the list without anything selected.


The Meaning of Life Button

| JavaScript | Web Site Design | WordPerfect Macros | mSQL | Java | Links |


JavaScript index pageHome

E-mail Pete the answers to all his questions.