Disable Enter to submit a form

Add the script
onKeyPress="return event.keyCode!=13"
in the BODY of the HTML document for all the web page,

OR

1. Disable in the form the submit.

<nested:form action="docMgmt"
onsubmit="return false;" styleId="my_form"/>

2. Creta a function that submit a from in your js script.
function submitFrm(objId){
var theform = document.getElementById(objId);
theform.submit();
return true;
}

3. call the above function from the submit button...
<nested:submit onclick="submitFrm('my_form');">Submit!!</nested:submit>

See the original view:
http://kreotekdev.wordpress.com/2007/11/16/disabling-the-enter-key-on-forms-using-javascript/

2 comments:

  1. I love the way you post this article. This is wonderful post. I do hope you intend to post more of these types of information. Thank you for this interesting information!

    Internet Marketing Company in India
    SEO Company in India

    ReplyDelete
  2. You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. Submit Articles

    ReplyDelete