J
Julia B
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="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<SCRIPT language="javascript">
function DisableKeyPress()
{
//alert(window.event.keyCode)
if (event.keyCode == 13)
{
event.cancelbubble = true;
event.returnvalue = false;
}
}
</SCRIPT>
</HEAD>
<body onKeyPress="DisableKeyPress()" 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="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<SCRIPT language="javascript">
function DisableKeyPress()
{
//alert(window.event.keyCode)
if (event.keyCode == 13)
{
event.cancelbubble = true;
event.returnvalue = false;
}
}
</SCRIPT>
</HEAD>
<body onKeyPress="DisableKeyPress()" 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