Any way to stop a Form from treating pressing the "Enter" key as the same clicking "Submit"? | Community
Skip to main content
October 29, 2015
Solved

Any way to stop a Form from treating pressing the "Enter" key as the same clicking "Submit"?

  • October 29, 2015
  • 1 reply
  • 3670 views

If someone is completing a form and presses the "Enter" key, is there any way to prevent the form from treating this the same as clicking the "Submit" button? Or is that a function of the web browser/web browser configuration? The situation is that there is a form with a text box for people to enter comments - and they are pressing "enter", presumably, to add a line break but this action submits the form so their comment is incomplete.

I'm guessing this isn't something configurable on the form - and my workaround would be to move the comments field up above one or more required fields, but would love to know if there's a better way.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

It's not normal behavior for a Marketo textarea (let alone a browser textarea in general) to interpret "Enter" as "Submit."  Are you using a textarea field, or simply a text field?

On the modern web, letting "Enter" trigger "Submit" in all other kinds of widgets but textareas is the expected action and not something you want to turn off. 

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
October 29, 2015

It's not normal behavior for a Marketo textarea (let alone a browser textarea in general) to interpret "Enter" as "Submit."  Are you using a textarea field, or simply a text field?

On the modern web, letting "Enter" trigger "Submit" in all other kinds of widgets but textareas is the expected action and not something you want to turn off. 

November 5, 2015

Hi Sanford - thank you! That was a good question. It's a text field rather than a text area.

SanfordWhiteman
Level 10
November 5, 2015

Right, in a text field, "Enter" should submit (at at least ​attempt ​to submit).  Otherwise your form doesn't behave like a standard form, violating Least Astonishment.