The auto-submit feature of web forms (when the enter key is pressed) can be useful in some situations but less than desirable in other situations. This script focuses on the latter.
When web form validation is done using javascript, sometimes a dialog box (such as an alert or confirm) is used. One of the potential problems with dialog boxes is that if someone hits the enter key (to get rid of the dialog box) the enter key event is passed back to the web form instead of being cancelled. This means that the web browser will try to go ahead and submit the web form...not that useful if some type of validation failed that would ordinarily prevent the web form from being submitted.
This script actually traps that default browser behavior so the web form is not submitted until validation actually passes. As well, when the enter key is pressed in a form element such as an input box, validation is forced before allowing the browser to submit the web form.
Test out the simple form below:
In order to begin working with this script, the two functions you will need to look at for your own validation requirements are "validationCheck()" and "validationCheckGroup()".
NOTE: You can download the script from the main javascript page.