input (type="submit") | NN 2 IE 3 DOM 1 | |||||||||||||||||||||||||||||||||||
The submit object is a form control generated with an input element that has a type attribute set to "submit". This object is similar to the button object, but a submit object has more implied power. No script action is necessary for the submit object to do its job of submitting the containing form to the server. If you require a button to perform a script action, but not an actual form submission, use the button or button-type input object instead. Otherwise, the submit object automatically reloads the current document (i.e., obeying the form's default action, which is the page's URL), perhaps destroying important script variables. To initiate form validation, use the onsubmit event handler of the form object rather than the onclick event handler of the submit button. If the event handler evaluates to true, the form is submitted; if it evaluates to false, the submission is cancelled. The scripted equivalent of a submit-type input object is the form object's submit( ) method. |
||||||||||||||||||||||||||||||||||||
HTML Equivalent | ||||||||||||||||||||||||||||||||||||
<input type="submit"> |
||||||||||||||||||||||||||||||||||||
Object Model Reference | ||||||||||||||||||||||||||||||||||||
[window.]document.formName.elementName [window.]document.forms[i].elements[i] [window.]document.getElementById("elementID") |
||||||||||||||||||||||||||||||||||||
Object-Specific Properties | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Object-Specific Methods | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Object-Specific Event Handler Properties | ||||||||||||||||||||||||||||||||||||
|
form | NN 2 IE 3 DOM 1 |
Read-only | |
Returns a reference to the form element that contains the current element. When processing an event from this element, the event handler function automatically has access to the input element (as the event object's target or srcElement property). By reading the form property, the script can easily access other controls within the same form. |
|
Example | |
var theForm = evt.srcElement.form; |
|
Value | |
form element object reference. |
|
Default | |
None. |
name | NN 2 IE 3 DOM 1 |
Read/Write | |
This is the identifier associated with the form control. Names are hidden from user view, since control labels are assigned via other means, depending on the control type. Form control names may also be used by script references to the objects. |
|
Example | |
document.orderForm.mySubmit.name = "sender"; |
|
Value | |
Case-sensitive string identifier that follows the rules of identifier naming: it may contain no whitespace, cannot begin with a numeral, and should avoid punctuation except for the underscore character. |
|
Default | |
None. |
type | NN 3 IE 4 DOM 1 |
Read-only | |
Returns the type of form control element. The value is returned in lowercase letters. You may have to cycle through all form elements in search of specific types to do some processing on (e.g., emptying all form controls of type "text", leaving other controls untouched). |
|
Example | |
if (document.forms[0].elements[3].type == "submit") { // process submit input type here } |
|
Value | |
Any of the following constants (as a string): button | checkbox | file | hidden | image | password | radio | reset | select-multiple | select-one | submit | text | textarea. |
|
Default | |
submit |
value | NN 2 IE 3 DOM 1 |
Read/Write | |
This is one of the rare times that the value property controls the label of a form control: the text that appears on the submit button. |
|
Example | |
document.forms[0].mySubmit.value = "Send"; |
|
Value | |
String. |
|
Default | |
Submit |
createTextRange( ) | NN n/a IE 4(Win) DOM n/a |
Creates a TextRange object containing the button's label text. See the TextRange object for details. |
|
Parameters | |
None. |
|
Returned Value | |
TextRange object. |
handleEvent[ ] | NN |4| IE n/a DOM n/a |
handleEvent(event) | |
Instructs the object to accept and process the event whose specifications are passed as the parameter to the method. The object must have an event handler for the event type to process the event. Navigator 4 only |
|
Parameters | |
|
|
Returned Value | |
None. |