Hi all
I've got a very complex form with loads of text boxes and buttons on it.
It's causing me all sorts of problems when users press the enter key and
cause a postback.
I need to disable the enter key. I've done some surfing and found some
Microsoft recommended code but it doesn't seem to work and I'm wondering what
I've done wrong. If possible I'd like to disable the enter key for the whole
form not for each text box (that would be sooooo complicated to implement).
I'm using .Net 1.1 and vb.
Here's what I've got at the moment.
<HEAD>
<title>Raise CSD</title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<SCRIPT language="javas cript">
function DisableKeyPress ()
{
//alert(window.ev ent.keyCode)
if (event.keyCode == 13)
{
event.cancelbub ble = true;
event.returnval ue = false;
}
}
</SCRIPT>
</HEAD>
<body onKeyPress="Dis ableKeyPress()" vLink="#000000" aLink="#d9d5d2"
link="#d7451a" MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server" >
then the code for the rest of the form.....
Thanks in advance!
Julia
I've got a very complex form with loads of text boxes and buttons on it.
It's causing me all sorts of problems when users press the enter key and
cause a postback.
I need to disable the enter key. I've done some surfing and found some
Microsoft recommended code but it doesn't seem to work and I'm wondering what
I've done wrong. If possible I'd like to disable the enter key for the whole
form not for each text box (that would be sooooo complicated to implement).
I'm using .Net 1.1 and vb.
Here's what I've got at the moment.
<HEAD>
<title>Raise CSD</title>
<meta content="Micros oft Visual Studio .NET 7.1" name="GENERATOR ">
<meta content="Visual Basic .NET 7.1" name="CODE_LANG UAGE">
<meta content="JavaSc ript" name="vs_defaul tClientScript">
<meta content="http://schemas.microso ft.com/intellisense/ie5"
name="vs_target Schema">
<SCRIPT language="javas cript">
function DisableKeyPress ()
{
//alert(window.ev ent.keyCode)
if (event.keyCode == 13)
{
event.cancelbub ble = true;
event.returnval ue = false;
}
}
</SCRIPT>
</HEAD>
<body onKeyPress="Dis ableKeyPress()" vLink="#000000" aLink="#d9d5d2"
link="#d7451a" MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server" >
then the code for the rest of the form.....
Thanks in advance!
Julia
Comment