Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Event Handlers
Submit
EVENT HANDLER: onSubmit
onSubmit
= myJavaScriptCode
Event handler for
Form
The
onSubmit
event handler is used to execute specified JavaScript code whenever the user submits a form, and as such, is included within the HTML <FORM> tag. The
onSubmit
event handler uses the following properties of the
Event
object:
type
- indicates the type of event.
target
- indicates the target object to which the event was sent.
In the following example, the
onSubmit
event handler calls the 'submitEvent' function:
Code:
<FORM onSubmit="submitEvent()">
If you want to validate the information in the form and only allow it to be submitted if it meets your requirements, you will need to put a
return
statement that returns
false
in the event handler, as in the following example using the 'validate' function:
Code:
<FORM onSubmit="return validate(this)">
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information