Workflow Soluiton

 View Only
  • 1.  Prevent Enter from submitting the form

    Posted Oct 01, 2009 01:07 PM
    I have a long web form and a few users have pressed Enter by accident before they complete it, submitting an incomplete form.  Is there a way to keep the Submit button from responding to a press of the Enter key?

    Thanks


  • 2.  RE: Prevent Enter from submitting the form

    Posted Oct 08, 2009 04:51 AM
    Hi

    Add the following in the Script-field (Right click form -> Edit form -> Behavior Tab):

    function cancelEnter(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 = cancelEnter; 

    A little explanation :
    The script will cancel all 'Enter's (evt.keyCode == 13)  whilst in a textbox (node.type=="text").