Last post Jul 16, 2019 02:37 PM by osmankaykaco2
None
0 Points
13 Posts
Jun 30, 2006 06:43 PM|fangrui|LINK
Member
21 Points
252 Posts
Jun 30, 2006 10:33 PM|jasonli|LINK
Jun 30, 2006 10:34 PM|jasonli|LINK
Star
9617 Points
3788 Posts
Jul 01, 2006 06:30 AM|e_screw|LINK
1 Post
May 14, 2009 09:08 AM|solartrain@yahoo.com|LINK
This worked nicely: if (eventArgs.KeyCode == 13) return false;
<asp:Button ID="btnOpen" runat="server" Text="Open" OnClientClick=" if (eventArgs.KeyCode == 13) return false;"/>
If a confimation is desired then use:
<asp:Button ID="btnOpen" runat="server" Text="Open" OnClientClick=" if (eventArgs.KeyCode == 13) return false; return confirm('All unsaved data will be lost. Continue Open?');"/>
Jul 16, 2019 02:37 PM|osmankaykaco2|LINK
This is so simple,
Try below on <body> tag
<body onkeydown="return (event.keyCode!=13)" onunload="">
None
0 Points
13 Posts
Disable the "Enter" as Submit behavior?
Jun 30, 2006 06:43 PM|fangrui|LINK
Does anyone know of any good way of getting rid of it?
Member
21 Points
252 Posts
Re: Disable the "Enter" as Submit behavior?
Jun 30, 2006 10:33 PM|jasonli|LINK
First, add onkeydown in the body tag:
<body onclick="javascript:EnterKeyFilter();" >
And then, add the function:
function EnterKeyFilter()
{ if (window.event.keyCode == 13)
{ event.returnValue=false;
event.cancel = true;
}
}
That's it.
Member
21 Points
252 Posts
Re: Disable the "Enter" as Submit behavior?
Jun 30, 2006 10:34 PM|jasonli|LINK
the body tag should like this:
<body onkeydown="javascript:EnterKeyFilter();">
Not onclick.
Star
9617 Points
3788 Posts
Re: Disable the "Enter" as Submit behavior?
Jul 01, 2006 06:30 AM|e_screw|LINK
If you were using ASP.Net buttons, then you can set the UseSubmitBehavior property to false.
Thanks
Electronic Screw
Website||Blog||Dub@i.net
None
0 Points
1 Post
Re: Disable the "Enter" as Submit behavior?
May 14, 2009 09:08 AM|solartrain@yahoo.com|LINK
This worked nicely: if (eventArgs.KeyCode == 13) return false;
<asp:Button ID="btnOpen" runat="server" Text="Open" OnClientClick=" if (eventArgs.KeyCode == 13) return false;"/>
If a confimation is desired then use:
<asp:Button ID="btnOpen" runat="server" Text="Open" OnClientClick=" if (eventArgs.KeyCode == 13) return false; return confirm('All unsaved data will be lost. Continue Open?');"/>
None
0 Points
1 Post
Re: Disable the "Enter" as Submit behavior?
Jul 16, 2019 02:37 PM|osmankaykaco2|LINK
This is so simple,
Try below on <body> tag
<body onkeydown="return (event.keyCode!=13)" onunload="">