Table of Content
The <input type=”submit”> defines a submit button which submits all form values to a form-handler.
The form-handler is typically a server page with a script for processing the input data.
The form-handler is in the form’s action attribute.
The input element, having the “submit” value in its type attribute, represents a button that, when pressed, submits the form it belongs to.
With the arrival of HTML5, several new attributes have been added to this element (formaction, formenctype, formmethod, formnovalidate and formtarget) that define and override specific parameters pertaining how the form must be submitted. These new attributes can be used, for example, to provide more than one submit button in one form, and make each of them perform a different type of submission.
What is the value in a submit input?
An <input type=”submit”> element’s value attribute contains a DOMString which is displayed as the button’s label. Buttons do not have true value otherwise.
<input type="submit" value="Send Request">
If you choose to use <button> elements to create the buttons in your form, keep this in mind: if there’s only one <button> inside the <form>, that button will be treated as the “submit” button. So you should be in the habit of expressly specifying which button is the submit button.
How to add a submit keyboard shortcut?
Keyboard shortcuts, also known as access keys and keyboard equivalents, let the user trigger a button using a key or combination of keys on the keyboard. To add a keyboard shortcut to a submit button — just as you would with any <input> for which it makes sense — you use the accesskey global attribute.
In this example, s is specified as the access key (you’ll need to press s plus the particular modifier keys for your browser/OS combination). Different modifier keys are used for access keys than for other shortcuts on the host computer.
How to validate a submit input?
Submit buttons don’t participate in constraint validation; they have no real value to be constrained.