Questions tagged [form-submit]

The submit event is sent to an element when the user is attempting to submit a form. It can only be attached to form elements. Forms can be submitted either by clicking an explicit , , or

The submit event is sent to an element when the user is attempting to submit a form. It can only be attached to <form> elements. Forms can be submitted either by clicking an explicit <input type="submit">, <input type="image">, or <button type="submit">, or by pressing Enter when certain form elements have focus.

Depending on the browser, the Enter key may only cause a form submission if the form has exactly one text field, or only when there is a submit button present. The interface should not rely on a particular behavior for this key unless the issue is forced by observing the keypress event for presses of the Enter key.

2883 questions
848
votes
33 answers

Prevent users from submitting a form by hitting Enter

I have a survey on a website, and there seems to be some issues with the users hitting enter (I don't know why) and accidentally submitting the survey (form) without clicking the submit button. Is there a way to prevent this? I'm using HTML, PHP…
DForck42
  • 17,905
  • 12
  • 52
  • 79
749
votes
35 answers

How do you handle multiple submit buttons in ASP.NET MVC Framework?

Is there some easy way to handle multiple submit buttons from the same form? For example: <% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %> <%…
Spoike
  • 112,352
  • 42
  • 133
  • 155
277
votes
25 answers

Multiple submit buttons in an HTML form

Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the back button appears first in the markup when you press Enter, it will use that button to submit the form. Example: