1. I have a form which I have to validate. I have written the validations for all the fields as separate functions in Validation.js file. Now, when I hit submit how do I ensure all the functions are invoked. and if it passes validation, to enter values into the database?
2. Is it possible to call the corresponding validation function(Which are all in the same file)for each input field from the html form .
Another possible solution is to validate the entry for each widget when the user tabs off of it and it loses focus and fires the onBlur event. This is possible if the various widgets can be validated in isolation. This is good for checking for numbers and not letters in a phone number field or letters and not number in a name field, etc.
If each field (or at least most of them) can be validated individually, then any combination validation can be done by the onSubmit event handler.
It is also a better user experience if you tell the user that their phone number, for example, is invalid because it has a letter as soon as they enter the phone number, not at the bottom of the form after they have filled in 20 more fields.
<a href="http://labryssystems.net/pblog/index.php" target="_blank" rel="nofollow">Javaville Gazette</a><br />Non-cooperation with evil is a duty. -- Mahatma Gandhi