Stop form from submitting when enter key is pressed on a muti-page form

  • Profile Image
    bistro305
    Asked on September 28, 2010 at 12:56 PM

    If a client hits the enter key after an entry rather that the tab key, the form will submit without being completed.  Is there a way around this?  Thanks

  • Profile Image
    mirandaandphil
    Answered on September 28, 2010 at 04:01 PM

    I am having exactly the same problem - I tried hiding the submit button until some other fields were completed, and made fields on other pages required. But hitting enter on the first page still submits the incomplete form!

  • Profile Image
    mirandaandphil
    Answered on September 29, 2010 at 06:55 AM

    Googling a bit leads me to believe that submit on enter is a common feature that causes problems in cases like mine, where required fields appear on later pages.

    The problem is that the user can submit with enter if they've completed all required fields on the current page. Thus the later questions never appear.

    An on/off for submit with enter would be a quick fix? Googling suggests there is a simple way to do that with some javascript, but I know next to nothing about such things!

    Thanks

  • Profile Image
    aytekin
    Answered on September 29, 2010 at 08:01 AM

    I added this to our bug list. I agree with you submit key should not submit a form when the user is in a non-final page of a multi-page form.

  • Profile Image
    mirandaandphil
    Answered on September 29, 2010 at 03:21 PM
    // JotForm.setConditions([{"action": {"field": "11", "visibility": "Hide"}, "link": "Any", "terms": [{"field": "6", "operator": "equals", "value": "No"}], "type": "field"}, {"action": {"field": "10", "visibility": "Hide"}, "link": "Any", "terms": [{"field": "6", "operator": "equals", "value": "No"}], "type": "field"}, {"action": {"field": "12", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "You and one other guest"}, {"field": "14", "operator": "equals", "value": "You and two other guests"}, {"field": "14", "operator": "equals", "value": "You and three other guests"}, {"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"field": "13", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "You and one other guest"}, {"field": "14", "operator": "equals", "value": "You and two other guests"}, {"field": "14", "operator": "equals", "value": "You and three other guests"}, {"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"field": "14", "visibility": "Hide"}, "link": "Any", "terms": [{"field": "6", "operator": "equals", "value": "No"}], "type": "field"}, {"action": {"field": "15", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "You and two other guests"}, {"field": "14", "operator": "equals", "value": "You and three other guests"}, {"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"field": "16", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "You and two other guests"}, {"field": "14", "operator": "equals", "value": "You and three other guests"}, {"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"field": "18", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "You and three other guests"}, {"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"field": "19", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "You and three other guests"}, {"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"field": "20", "visibility": "Show"}, "link": "Any", "terms": [{"field": "14", "operator": "equals", "value": "More"}], "type": "field"}, {"action": {"skipTo": "page-1"}, "link": "All", "terms": [{"field": "22", "operator": "notEquals", "value": "pirates"}, {"field": "22", "operator": "notEquals", "value": "Pirates"}], "type": "page"}, {"action": {"field": "25", "visibility": "Show"}, "link": "All", "terms": [{"field": "22", "operator": "notEquals", "value": "pirates"}, {"field": "22", "operator": "notEquals", "value": "Pirates"}], "type": "field"}, {"action": {"field": "17", "visibility": "Hide"}, "link": "Any", "terms": [{"field": "6", "operator": "equals", "value": "No"}], "type": "field"}, {"action": {"field": "2", "visibility": "Hide"}, "link": "Any", "terms": [{"field": "14", "operator": "isEmpty", "value": false}], "type": "field"}, {"type": "field", "link": "Any", "terms": [{"field": "22", "operator": "equals", "value": "pirates"}, {"field": "22", "operator": "equals", "value": "Pirates"}], "action": {"field": "28", "visibility": "Show"}}]); JotForm.init(function(){ JotForm.description('input_22', 'This can be found in the paper invitation that you should have been sent!'); $('input_5').hint('ex: myname@example.com'); JotForm.description('input_10', 'We make no promises but will try to provide something for everyone!'); JotForm.description('input_17', 'eg dietary'); }); //

    Thanks very much for your agreement!

    I solved the problem temporarily by adding a small bit of code to the form html (thanks also for allowing us to download the whole thing).

    To share with bistro305 - where it says <form class="jotform-form" action="http://www.jotform.com/submit.php" ........ >, you can add in this bit:

    onsubmit="return false;"

    That stops enter doing any submissions. Hope that helps!

  • Profile Image
    aytekin
    Answered on September 30, 2010 at 05:17 AM

    That looks great. Thank you for sharing the solution.

  • Profile Image
    mirandaandphil
    Answered on January 19, 2011 at 03:31 PM

    Hi, our form has stopped working with this fix; now, clicking submit doesn't actually submit, but hangs at the default 'please wait...'

    So we're back to a front page that when users hit enter, the whole form submits. Any ideas?

  • Profile Image
    TreyOler
    Answered on January 19, 2011 at 06:06 PM

    I need a fix for this too.  Preferably without having to add custom html because I am constantly updating my forms and it would be a pain to always have to re-insert the code into the new html.

  • Profile Image
    aytekin
    Answered on January 20, 2011 at 07:07 AM

    This is in our bug list. When we have a fix we will post it on this thread. We cannot with your custom code changes on your own source code. You will need to find someone familiar with javascript and get help. 

  • Profile Image
    Mike22
    Answered on April 26, 2011 at 07:09 PM

    For forms that you don't want to change url due to the ajax nature:

    Make a function that always returns false:

    myFn(){

    doStuff();

    return false;

    }

    within doStuff() call your ajax method / send a get/post request

    Then have the form (and button) call myFn using onSubmit

    => you now have a form that always returns false (so doesnt go anywhere) and still 'does stuff'

  • Profile Image
    ssmith
    Answered on May 26, 2011 at 08:43 AM

    This has been on your bug list since sept 2010...

  • Profile Image
    bistro305
    Answered on May 26, 2011 at 08:47 AM
    New response received?


    ----- Original Message -----
  • Profile Image
    icMakeup
    Answered on September 15, 2011 at 11:01 PM

    Any fix to this yet?

  • Profile Image
    aytekin
    Answered on September 18, 2011 at 06:05 AM

    This one is still in our todo list. I now assigned to a different developer now. He should be able to work on it within 1-2 months. Thanks. 

  • Profile Image
    emrew86
    Answered on September 22, 2011 at 07:08 AM

    bug has been fixed...

  • Profile Image
    bistro305
    Answered on September 22, 2011 at 07:34 AM
    New response receivedThank-you!


    ----- Original Message -----
  • Profile Image
    brx250
    Answered on September 22, 2011 at 09:43 PM

    Hi bistro305,

    You are always welcome!

    If you have further issues and concerns, please feel free to contact us again.

    Thank you and enjoy using JotForm!

    _____________________________________________     

    Albert  JotForm Support  

  • Profile Image
    leadershiptyler
    Answered on June 25, 2012 at 11:54 AM

    I am still having this problem with submit on hitting return - can anyone tell me if this was resolved? Or if there is another thread I can reference?

  • Profile Image
    jeanettebmz
    Answered on June 25, 2012 at 08:18 PM

    @leadershiptyler

    Could you please open a new thread so we can investigate your case further?

    Cheers!

    Jeanette