0

When I have a submit button, it sends the form when I press enter.

Is the submit button necessary?

I am thinking of removing the button if it is unnecessary.

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
Uğur Gümüşhan
  • 2,455
  • 4
  • 34
  • 62

2 Answers2

2

You need the submit button, otherwise the input is just an input.

Of course, you could use some javascript to force the submission, either onblur (when the input loses focus) or when the enter key is pressed.

However, I think this is a very bad idea from a user experience point of view. People expect a submit button.

Here is another SO answer with some suggestions:

Submitting a form by pressing enter without a submit button

Community
  • 1
  • 1
Jason Gennaro
  • 34,535
  • 8
  • 65
  • 86
1

In a <form>, one can submit by pressing the Enter key when you have a text input but hide your submit button.

<form action="wherever">
    <input type="text" name="input" />
    <input type="submit" value="Submit" name="submit" style="display: none;" />
</form>

This type of buttonless interface may be useful in interfaces like a command prompt, but generally, users often recognize a form with a submit button.

Deltik
  • 1,129
  • 7
  • 32