The FORM tag is used to begin the definition of an HTML form. It includes attributes from the METHOD to be used in submitting the form, the ACTION to be taken, and may also include a single type of event handler attribute, the onSubmit attribute. The syntax for a FORM tag is the following:
<FORM NAME=”formname” … onSubmit=”submithandler()”>
The onSubmit handler is invoked when the form’s contents are about to be submitted. This is a top level action that applies to the entire form. It is also possible to specify an onClick action on the Submit button in a form, “Button Click Events.” The natural use of an onSubmit handler is to validate the contents of a form. The submission proceeds if the contents are valid, and is canceled if they are not.