Back to HTML

Buttons in Forms: submit, reset and button

Coding Tutorials Team 28 June 2026

Buttons look simple and have a default behaviour that causes a specific, common and confusing bug. Knowing the three types and which one you get by accident prevents it.

The default type is submit

A button element inside a form with no type attribute is a submit button. This is defined behaviour rather than a quirk, and it means any button you add for another purpose will submit the form unless you say otherwise.

<button>Add another item</button>        <!-- submits the form --> <button type="button">Add another</button>  <!-- does nothing by itself -->

The symptom is a form that reloads the page when the user clicks a control that was supposed to do something else. Always set the type attribute explicitly on every button in a form, including the submit one, so the intent is visible in the markup.

The three types

Submit sends the form. Button does nothing without a script attached and is the type for any in-page action. Reset restores every control to its initial value.

Reset deserves a warning. It is almost always a mistake to include one. It sits next to submit, it looks similar, and clicking it destroys everything the user has typed with no confirmation and no undo. The cases where anyone genuinely wants to clear a whole form are rare enough that the risk outweighs the convenience.

Button element or input element

Both can produce a submit button. The input version takes its text from a value attribute, while the button element takes it from its content.

<input type="submit" value="Send"> <button type="submit">Send</button>

The button element is generally preferable because its content can include markup, which means an icon alongside text, or a nested span for styling. The input version is limited to plain text.

One difference matters for submission. A button element has both a value attribute and content, and only the value is submitted, which allows the visible text and the submitted data to differ. An input submits its visible text, which couples the two.

Multiple submit buttons

A form may have several submit buttons, and only the one that was clicked is included in the submitted data. This lets one form offer different actions.

<button type="submit" name="action" value="save">Save draft</button> <button type="submit" name="action" value="publish">Publish</button>

The server reads the action key to determine what was intended. This is a clean pattern that avoids hidden fields and scripting entirely.

Note that pressing enter in a text field activates the first submit button in the form, so order matters. Put the primary action first, or a user pressing enter will trigger the wrong one.

Overriding the form on a button

Several attributes on a submit button override the form's own settings for that submission. The formaction attribute changes the destination, formmethod changes the method, and formnovalidate skips validation.

The last is genuinely useful for a save draft button, which should accept an incomplete form while the publish button enforces every requirement.

Buttons and links are not interchangeable

A button performs an action. A link navigates to a destination. Styling one to look like the other is fine, and using one where the other belongs is not.

The differences are functional. A link can be opened in a new tab, copied, bookmarked and shared, and appears in browsing history. A button cannot and is not expected to. Keyboard behaviour differs too: a link activates on enter only, while a button responds to both enter and space, and users depend on that.

A div with a click handler is the worst of both. It is not focusable, not announced as interactive, and does not respond to the keyboard unless a great deal of work is done to reproduce what a real button does for free.

Accessible names for icon buttons

A button containing only an icon has no text content, so it has no accessible name and is announced as nothing more than a button. This is common on close controls, menu toggles and search buttons.

The fix is either visually hidden text inside the button or an aria-label attribute on it. Where the icon is an inline SVG, it should additionally be hidden from assistive technology so it is not announced alongside the label. The same applies to a button that has both an icon and text: the icon is decoration and the text is the name.

Disabled buttons

A disabled button cannot be focused, so a keyboard user tabbing through the form never encounters it and receives no explanation of why they cannot proceed. Disabling a submit button until a form is valid is a common pattern that leaves users stuck with no feedback.

Leaving the button enabled and reporting errors on submission is usually better. The user always has something to press, and the errors tell them exactly what to fix.