Java script validating form
In other words if the first condition fails, the second condition will not be tested and so forth.
Only when all conditions have been satisfied do we reach the command, in which case the form will be submitted.
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.
To take things a step further you can even explore Ajax Form Validation which lets you supply real-time feedback using server-side scripts triggered by Java Script events.
Validating form input with Java Script is easy to do and can save a lot of unnecessary calls to the server as all processing is handled by the web browser.
It can prevent people from leaving fields blank, from entering too little or too much or from using invalid characters.
But if the user unchecks the box, the user DOESNT have to enter info in textarea.
It is important to validate the form submitted by the user because it can have inappropriate values. The Java Script provides you the facility the validate the form on the client side so processing will be fast than server-side validation.So, most of the web developers prefer Java Script form validation.