Normally you would modify this so that you could submit or not submit the form based on the number of items selected. For example, a text input that only needs to have a value if a checkbox is checked: Using simple logical operators and the functions supplied above you can do all sorts of client-side form validation.
The purpose of a form validation script is to return a boolean value ('s to reference form fields, but that can lead to namespace conflicts and why make things more complicated than necessary.
You'll see that the all validation scripts presented on this and subsequent pages adhere to the same basic format.
Most modern browsers now support HTML5 Form Validation making it possible to validate form elements without (or before) any Java Script is triggered.
But if the user unchecks the box, the user DOESNT have to enter info in textarea.