All Objects
Button
Checkbox
FileUpload
Hidden
Password
Radio
Reset
Select
Submit
Text
Textarea
>
OBJECT: Form
Forms allow us to prompt a user for input using elements such as radio buttons, checkboxes and selection lists. Data gathered in this manner can then be posted to a server for processing. A
form
is created by enclosing HTML controls and other elements within
<form></form>
tags. A page can contain as many forms as required, but they cannot be overlapping or nested (the closing
</form>
tag of a form must precede the opening tag of any subsequent form).
PROPERTIES
action Property
This property specifies the URL address to which the data gathered by the
form
will be submitted. An email address can also be specified using the 'mailto:anybody@anywhere.com' syntax.
Syntax:
object.
action
= URL
elements Property
This property is an array containing an object for each element on the
form
. These objects (checkboxes, radio buttons, etc.) are added to the array in the order that they appear in the document's source code.
Syntax:
object.
elements
encoding Property
This property sets the MIME type that is used to encode the data gathered by the elements in a form for submission when using the
post
method. This property initially contains a string reflecting the
enctype
attribute of the
form
tag, but using
encoding
will override this.
Syntax:
object.
encoding
length Property
This property returns the number of elements in a form.
Syntax:
object.
length
method Property
This property is a string specifying how information input in a form is submitted to the server. This should return either 'get', which is the default, or 'post'.
Syntax:
object.
method
name Property
This property sets or returns the name of the form. Initially contains the
name
attribute of the
<form>
tag.
Syntax:
object.
name
target Property
This property sets or returns the target window that responses are sent to after submission of a form.
Syntax:
object.
target
METHODS
handleEvent Method
This method invokes the event handler for the specified event.
Syntax:
object.
handleEvent
"event"
reset Method
This method resets the default values of any elements in a form. Emulates the clicking of a Reset button (athough it is not necessary to have a reset button in a form to use this method).
Syntax:
object.
reset( )
submit Method
This method submits a Form. This is the same as clicking a
Submit
button.
Syntax:
object.
submit( )
EVENT HANDLERS
onReset
Event handler
The
onReset
event handler is used to execute specified JavaScript code whenever the user resets a form by cicking a Reset button.
Syntax:
object.
onReset
="myJavaScriptCode"
onSubmit
Event handler
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
Syntax:
object.
onSubmit
="myJavaScriptCode"
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information