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 to stop form submitting when 'enter' is pressed?

    Asked by ksiraj on March 31, 2014 at 09:14 AM

    A user (on Sarari) was filling in the form and everytime he pressed enter, the form submitted.  How do I stop this happening?

    Thanks

    thanks and
  • Profile Image

    Answered by Carina on March 31, 2014 at 10:59 AM

    I will look further for a code solution on this and will get back to you.

    Thank you

  • Profile Image

    Answered by Carina on April 06, 2014 at 04:04 PM

    It is necessary that you download and edit the form's source code: 

    Now it is necessary that you paste only the green parts into your form's source code. The script part is inserted inside the <head> tag. The "onkeydown" needs to be added to all the fields where we wish to disable enter key:

    <pre>

    <HTML>

    <HEAD>

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

    </HEAD>

    <BODY>

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

    </FORM>

    </BODY>

    </HTML>

    </pre>

    You can test this form. Only the name field has this code associated, because it is important to keep the enter function on the comment box:

    https://shots.jotform.com/carina/html/test_prevent_enter_key.html

    Let us know if we can be of assistance.

    Thank you

  • Profile Image
    JotForm Support

    Answered by BDAVID on May 17, 2016 at 04:56 PM

    For some reason your reply seems to have come empty, please let us know if you need more help we will be glad to assist you.

  • Profile Image

    Answered by ksiraj on May 18, 2016 at 03:44 AM
    Hi, thanks for the message, the matter is solved so no further action
    required. Thank you.
    Kate
    Kate Siraj
    Ayurvedic Practitioner
    BSc Ayurveda (Manipal), MChem (Oxon), MAPA
    020 3166 5086 / 07980 285 268
    22 Hogarth Way, Hampton, TW12 2EL
    www.theayurvedapractice.com
    ...
  • Profile Image

    Answered by PCIrish on June 06, 2016 at 07:40 PM

    This is nuts.  If I could figure out how to do this, I probably would not have needed JOTFORM in the first place.  Please, Jotform, give us another solution.

  • Profile Image
    JotForm Support

    Answered by BDAVID on June 06, 2016 at 08:47 PM

    @PCIrish, I see you have opened a thread for your concern: https://www.jotform.com/answers/854877, you will be assisted there, thanks.