Forms with multiple submit buttons are problematic

Multiple submit buttons are problematic for keyboard users because forms can be submitted by pressing Enter when a field is focused.

When this happens the form will be submitted as if the user pressed the first button within the <form> element which isn’t always desirable.

# An example

Take the following address form with a postcode lookup.

Delivery address form
Delivery address form with multiple submit buttons

Pressing Enter from with any of the form fields will submit the form as if the ‘Find address’ button was clicked.

This at little odd as the ‘Save address’ button is the primary action here.

# How to solve this

# Separate into 2 forms

Split each action into 2 completely separate forms.

In this case, let users first search for their address via the postcode but give users an option to enter their address manually.

Having one action perform makes things simple and clear.

Delivery address form split
Delivery address postcode lookup with just one call to action

# 2. Put the main submit button first

If you can’t separate the forms, then you need to identify the form’s main action.

If it doesn’t naturally come first in the <form> then you can duplicate it and place it at the top of the form.

To remove it visually you can use this:

.visually-hidden {
  border: 0!important;
  clip: rect(0 0 0 0)!important;
  height: 1px!important;
  margin: -1px!important;
  overflow: hidden!important;
  padding: 0!important;
  position: absolute!important;
  width: 1px!important;

This introduces the problem that when a user tabs to the hidden button, the interface will appear unresponsive.

To fix this, give the button a tabindex="-1" attribute to stop the button being navigable via keyboard.

# Checklist

  1. Avoid multiple submit buttons whenever possible
  2. If you must have multiple submit buttons put the primary action first
  3. If putting it first visually doesn’t work, then hide it visually with CSS and the tabindex attribute