How can I prevent the Enter/Return key from submitting the form?

  • Profile Image
    jahaearne
    Asked on May 11, 2017 at 01:33 PM
    One thing I did notice
    is that if you hit 'enter' to say mark a checkbox, then it submits the
    form. Is there away to remove that function to avoid submitting too early?
  • Profile Image
    Jim_R
    Answered on May 11, 2017 at 01:48 PM

    I'm afraid forms were designed that way (regardless if it's built in Jotform or not). This is something referred to as Implicit Submission as described on HTML5 specifications.

    This is important to accessibility, assistive technologies and impaired users that cannot use a mouse at all. There are pages on the Web that are only usable if there is a way to implicitly submit forms, so user-agents (browsers) are strongly encouraged to support this.

    If you really want to suppress this default behavior of forms, the only way around it with is to do it outside JotForm. Just get your form's Full Source Code, deploy it on your website, and use Javascript to prevent the Enter key from submitting the form.

    Complete guide: How-to-get-the-Full-Source-Code-of-your-Form 

    I found a really good read about this topic on this post in case you're interested to know why it was designed that way. At the latter part of that post will be alternatives on suppressing it (especially the Explicit Prevention part where they gave an example JS code snippet to prevent it).

  • Profile Image
    jahaearne
    Answered on May 11, 2017 at 02:43 PM
    Thank you very much, what I will do, is I will make one of the last
    questions mandatory so that it won't submit until they've done the last
    question.
    ...
  • Profile Image
    Jim_R
    Answered on May 11, 2017 at 03:08 PM

    Sure, that idea should work 😊 But ideally, you should set some (if not, most) of your fields as required to begin with so you'll get the most of out of your respondents. Unless they are really optional, important things like their email address, name, etc. should be set as required IMHO.

    I'm recommending an article below, it's a good read about required fields so you may want to check it out if you have some time.

    Related article: Should-You-Use-Required-Fields-on-Your-Form 

  • Profile Image
    jahaearne
    Answered on May 11, 2017 at 03:44 PM
    thank you !!!
    ...