Enter key is submitting incomplete form. How do I deactivate?

  • Profile Image
    polktft
    Asked on December 31, 2011 at 07:30 AM

    Anytime the Enter key is pressed, it is causing my form to be submitted.  How do I disable this?

    Too many people will press the enter key instead of using mouse or tab key.

    Bernie

  • Profile Image
    liyam
    Answered on December 31, 2011 at 08:26 AM

    To prevent your forms from getting submitted when pressing the enter key, you can try setting the fields as required by clicking on the form element and then turning on 'Required' tool in the tool bar, just above the form editor.

    This way, if they press enter, it will alert the form that there are still some required fields that are left blank.

    Another alternative way is exporting your HTML source code to your own HTML file.  Then you can paste this code within the header (<head> script here </head>) tags:

    <script language=javascript type=text/javascript>
    <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development
    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.type=="text")) {return false;}
    }

    document.onkeypress = stopRKey;
    -->
    </script>

    Please let us know if you need further assistance regarding this matter.

  • Profile Image
    polktft
    Answered on December 31, 2011 at 08:40 AM
    Thanks, I did that a few minutes ago.
    Bernie