What Is an HTML Submit Button?

Ray Hawk

A hypertext markup language (HTML) submit button is a type of computer code used for a website that displays a graphic image of a button, which, once clicked on with a mouse cursor, results in the execution of a predefined command. Usually, an HTML submit button is included at the bottom of an online form, and, once the form is completely filled out by a visitor to the website and the button is "pressed," the code connected to the button executes a command that transmits the contents of the form to the website manager as a text or email file. The HTML submit button is one of the earliest and most fundamental graphically-controlled interactive features created for websites. Since it is a very early form of HTML code, it is widely recognized by almost all versions and types of Internet browsers and is a reliable method of carrying out website form actions on behalf of visitors to the site.

A typical line of HTML code for a website that controls a submit button would be written in the following format: .
A typical line of HTML code for a website that controls a submit button would be written in the following format: .

A typical line of HTML code for a website that controls a submit button would be written in the following format: <input type="text" name="FirstName" value="Submit" />

Each collection of words separated by a space within the "tags" or opening and closing less-than and greater-than signs performs a different function. The "input" element defines the action of the button as one that will accept user interactions, and the "type" for this element defines what can be entered in the form, such as text. The "name" value defines what is allowed in the form such as someone's name, which can further be defined by limiting factors such as "maxlength" which limit names entered to a certain number of characters. The "value" element of the code defines the action the button actually takes when it is clicked on by a mouse cursor, with "submit" resulting in the text entered in the form being sent to the website manager's account.

Writing HTML is fairly simple for basic commands, as there are often several different ways to perform a command that are valid. The HTML submit button is an example of this, where some flexibility is offered for those new to working with HTML. The submit features for the button can be entered on separate lines within the <form> value of the HTML code, to more clearly define what they do. For example, on one line of code the action or "input" value of the form can be defined as <form action="post.asp" method="post"> where the data is submitted as an active server page (asp), which is an enhanced version of HTML. The following two lines of code would have <input type="text" name="FirstName"> and <input type="submit"> to clearly separate each action that the HTML submit button takes when it is activated.

Website design also allows for other actions aside from the standard "submit" action when the HTML submit button is clicked on. These include setting the input type="reset" so that, when the button is pressed, all of the data in the form is cleared out. Also, an input type="button" line of code will allow the button to actually show a visual presentation of the submit button being pressed down when clicked on by the mouse cursor, like a button in real life would show. Since "button" is not a recognized part of standard form processor code, however, an HTML editor typically links this command to additional JavaScript code so that other operations can be performed when it is activated.

You might also Like

Discuss this Article

Post your comments
Forgot password?