Clean way to prevent enter button submitting a form

Ben picture Ben · Apr 21, 2011 · Viewed 36.5k times · Source

I've seen a lot of Javascript solutions to do this, but I'm sure there must be an easier way.

I have a really simple form - one multiline textbox and a submit button. I want the user to be able to submit "formatted" text (i.e. like an email, with paragraphs, new lines etc)

However, when the user hits Enter to put in a carriage return it submits the form.

I'm there there must be a property or something that controls this, as this must be a common issue. Javascript as a solution seems a bit too complex.

Answer

Max picture Max · Sep 26, 2014

Set the UseSubmitBehavior property on the submit button to FALSE. (found the solution here)