Submit Button
A button that, when clicked, submits the data according to the attributes of the form.
Basics
Bare-bones code for a button is:
<INPUT TYPE="submit" VALUE="Label">
This renders the button only with the VALUE appearing as text on the button. It's possible to omit the VALUE, but the button may not display at all if this is done.
Usage
A submit button is necessary to submit the form, unless there is a JavaScript command that submits the form in response to another screen event.
Processing
Implementation among Web browsers varies. Some will sent a name=value pair indicating the NAME and VALUE of the button that was clicked. Others will not send anything at all.
HTML Attributes
A submit button typically has only name and value (and the name is often omitted), but may also have the following:
- ACCESSKEY - A shortcut key to put focus on the element.
- DISABLED - Grays out the element and prevents the user from altering its value.
- TABINDEX - Specified as a number, this alters the default tabbing order of a form.
Worth noting: the text supplied as the VALUE will be displayed on the button, and may be text only (not HTML code to format it)
JavaScript
Properties
A submit button has no unique or unusual JavaScript properties.
Methods
- click() - Simulates a user click on the button.
Event Handlers
- onclick - Takes effect when the element is clicked (before the form is submitted)
Misc Notes
A submit button is useful for a bare-bones method to submit the form. If there are commands to be executed before submitting, a better approach would be to code a generic button that will execute the commands and submit the form programatically.