<FORM onSubmit="handler-statements" a definition of the handler ...attributes... other attributes here > form.onsubmit a reference to the handler form.onsubmit(); an explicit invocation of the handler
onsubmit() is an event handler which is invoked when the form it is associated with is submitted, either when the user clicks a Submit button object, or when the submit() method is called for the form. This event handler is defined by the onSubmit attribute of the <FORM> tag that defines a form. The value of the attribute may be any number of JavaScript statements, separated by semicolons; these statements will be executed when the form is submitted.
A typical use of the onsubmit() event handler is to check that the user's input is valid before sending it over the network to a server. If the data is not valid, the onsubmit() handler may cancel form submission by returning the value false. If the handler returns any other value, or returns no value at all then the form will be submitted normally.
Whenever you use the onsubmit() event handler to cancel the submission of a form, you should be sure to notify the user why the submission was canceled, so that they can correct the problem. Window.alert() is a useful way to provide this information to the user.
file: /Techref/language/java/script/definitive/refp_137.htm, 5KB, , updated: 2019/10/14 15:00, local time: 2024/11/26 12:57,
3.137.159.134:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/language/java/script/definitive/refp_137.htm"> [Chapter 21] Reference: Form.onsubmit()</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.