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

    How do I prevent accidentally submitting the form every time I mistakenly press ENTER after completing a field?

    Asked by worldpeaceforall on February 13, 2016 at 09:02 PM
    accidentally after completing how
  • Profile Image
    JotForm Support

    Answered by Nik_C on February 14, 2016 at 07:27 AM

    Hi, 

    Easiest way to do this is to make your fields required, if user taps enter key it will try to submit your form but it won't submit it because all required fields are not filled. You can use either that, or you can add code to form that prevents form from submitting.

    To make fields required you click on field that you want to make required, and make sure it looks like in the picture.

     

    For other option you need to download your forms source code.

    You do that by clicking on "Publish" button.

    In wizard choose option to embed form

    There you can see an option to choose what kind of embed you want to do. You need to choose Source code from the dropdown menu 

    When you:

    1. picked Source code option from dropdown menu.

    2.Click on download source code button.

    Download should begin and you should get a zip archive containing your forms source code. You can open your forms source code in any text editor. After you downloaded your forms source. You need to open your html file, it should be named YOUR_FORM_NAME.html open it in any text editor and insert the following code Blue lines is what you need to insert. 

    <html>

    <head>

    <script type="text/javascript"> function disableEnterButton() { if (event.keyCode == 13) { event.cancelBubble = true; event.returnValue = false; } } </script> 

    </head>

    <body>

    <form id="your_form_id" name="your_form_name" method="GET" action="your_form_action" style="your_form_style"> <input id="textfield2" name="textfield2" onkeydown="disableEnterButton();">

    <input id="textfield2" name="textfield2" onkeydown="disableEnterButton();">

    <input type="submit"" value="submit">

    </form>

    </body>

     </html>

     

    You must add  onkeydown="disableEnterButton();"  for every field for which you want to disable submission on enter key.

    Remember, every time you want to change something in your form, you must update your form code. That means you must re-embeed your form to your website every time.

    I recommend first option because it is easier to solve your problem.

     

    I hope this helps you, please let me know if this solved your problem.

     

    Best regards