This tutorial will show you how to create a Java Script-enabled form that checks whether a user has filled in the form correctly before it's sent to the server. First we'll explain why form validation is a useful thing, and then build up a simple example form, explaining things as we go along.
At the end, there's a little exercise to keep you busy too!
We'll also look at how to check other types of fields, such as checkboxes, radio buttons and drop-down lists.
Let's look at a more complex validated form with some different types of form fields. Try pressing the Send Details button without filling in the form and see what happens.
Then, after they fill in the "Name" field and press "Send Details" again, it will prompt them for the "Gender" field.