Validating dropdowns

28-Dec-2017 15:39

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.You can see that the page consists of a Java Script function called That's all there is to simple Java Script form validation!If the user has not completed more than one field, then they will see an alert box appear for each field that is missing.Now you know how to write a form validation script that can handle multiple form fields, including text boxes, radio buttons, drop-down lists and check boxes!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.

validating dropdowns-40

gender differences in mate selection evidence from a speed dating

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.Finally, the "Terms and Conditions" checkbox is validated.