What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Prevent Users from Accidentally Submitting a form if Enter Key is pressed?

    Asked by greystreet41 on April 14, 2016 at 11:20 AM

    I have issues with clients accidently pressing the "enter" button on their keyboard and the form they were filling out gets submitted half done. I have always had the submit button but if my client is in a dialog box and they press enter it has submitted the form. Is there a way to only submit the form when complete?

    Page URL:
    http://www.dalcoclosing.com/#!request/cn3p

    and in client a disable enter key enter key pressed enter key
  • Profile Image
    JotForm Support

    Answered by KadeJM on April 14, 2016 at 12:38 PM

    I see that you are having an issue with your form accidentally being submitted if the enter key is pressed by your clients sometimes.

    While we don't have a feature that controls that sort of option yet it is possible to do this via the form's full source code which can then be re-embedded onto your webpage to prevent it.

     

    First you need to download your form's full source code.

     

    You can then try something like this -

    (1) Add this script in between the <Head></Head> of your page html:

    <SCRIPT LANGUAGE="javascript"> function testForEnter() { if (event.keyCode == 13) { event.cancelBubble = true; event.returnValue = false; } } </SCRIPT> 

     

    (2) Add this script in between the <Body></Body> of your page's html.

    <FORM id="YourForm" name="YourForm" method="GET" action="testSubmit.htm" style="background-color:orange"> <H2>YourForm: Stops form submission when user presses ENTER key.</H2> <INPUT id="textarea" name="textarea" onkeydown="testForEnter();"> <INPUT type="submit" value="Submit">

    You can swap out the id and names with your own form name and field values and your text area and textbox fields and such to prevent those from submitting when enter is pressed.