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

    Pressing Enter submits the form

    Asked by Palmerston_House on August 08, 2016 at 04:48 AM

    Under testing, when a user presses the Enter key to separate a paragraph of text or to jump to the next field it submits the half completed form.

    Is it possible to stop this action and require the submit button only to be clicked on?

     

    Thanks, Alex.

    Page URL:
    https://form.jotformeu.com/62156003404341

  • Profile Image
    JotForm Support

    Answered by EltonCris on August 08, 2016 at 06:09 AM

    That's the normal behavior of the form when you do not have required fields left.

    There are two ways to stop it from happening.

    1. This one is easy, simply add a required captcha field at the bottom of your form. This should prevent your form from submitting when the enter key is pressed.

    Captcha field is under Quick fields.

    2. This one requires using the form source code. When you embed your form, you have to use your form source code and append the following script at the bottom of your form source code so when the enter key is pressed, it won't trigger the submit button.

    <script type="text/javascript">

    function stopRKey(evt) {

      var evt = (evt) ? evt : ((event) ? event : null);

      var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

      if (evt.keyCode == 13 && node.nodeName != "TEXTAREA")  {return false;}

    }

    document.onkeypress = stopRKey;

    </script>

    Hope this helps!