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.
Again, you might like to open the source code for this form in a separate window, so that you can refer to it as we talk you through.
Like our previous example, this page has a form called start at zero (for the first option).
Finally, the "Terms and Conditions" checkbox is validated.
For example, if they miss out the "Name" and "Gender" fields and press "Send Details", it will only prompt them for the "Name" field initially.
One point to note about Java Script validation is that it can always be circumvented by the user disabling Java Script in their browser, so for secure validation you'll need to write your validating code in your server-side scripts.However, for day-to-day use Java Script is a quick and easy way to check over your forms before they're sent to your server.Our example script works by validating all the form fields at once.This can be a bit confusing for the user, especially if they've missed out more than one field, as they will get lots of alert boxes appearing and they might forget which fields they need to fill in!As an exercise, try modifying the script to only prompt the user one field at a time.