Validating a checkbox using javascript

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.I have a registraion form setup with javascript validation in place, but there is one place I'm having trouble.I have a dropdown selection list, and based on the selection, there are text fields that are hidden or displayed for more info.You might like to open the source code for this form in a separate window, so that you can refer to it throughout the tutorial.

Great for "required fields" such as email addresses!

Our example is very simple as it only checks one field.

Let's expand this example with a more complex function that checks lots of form fields.

Form validation is the process of checking that a form has been filled in correctly before it is processed.

For example, if your form has a box for the user to type their email address, you might want your form handler to check that they've filled in their address before you deal with the rest of the form.


Leave a Reply