Jump to content
  • 0

Disable Enter Key Problem in Form


ppbb123

Question

5 answers to this question

Recommended Posts

  • 0

Try to add the code to the head of your DataPage:

<script language="javascript" type="text/javascript">
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>
Link to comment
Share on other sites

  • 0

Small addition. If document already has some handler we need keep it and execute. Please look at code bellow.

var prevKeyPress = document.onkeypress;

document.onkeypress = function(e) {
	if(!e) { e = window.event; }
	try { if (prevKeyPress) prevKeyPress(e); } catch (ex) { }
	
        // Do something

}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...