Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Enter Key H*ll, control enter key submit button

Reply
Thread Tools

Enter Key H*ll, control enter key submit button

 
 
BrianDH
Guest
Posts: n/a
 
      01-12-2005
Hi
VB.Net code Behind, Web form.
I am looking for a way to stop my web form application
from firering a button click when the user hits the Enter
key.
I only want to button to bubmit, or exit or clear when
they click the button not in random when they hit the
enter key.

Thanks for the help.
BrianDH
 
Reply With Quote
 
 
 
 
BrianDh
Guest
Posts: n/a
 
      01-12-2005
Thank you!!!!!!!!

Damn microsoft! Now I have to write vb.net, and
javascript in one app. Yep we are moving forward! ;-D

Thanks

>-----Original Message-----
>On Wed, 12 Jan 2005 07:45:29 -0800, "BrianDH"
><> wrote:
>
>>Hi
>>VB.Net code Behind, Web form.
>>I am looking for a way to stop my web form application
>>from firering a button click when the user hits the

Enter
>>key.
>>I only want to button to bubmit, or exit or clear when
>>they click the button not in random when they hit the
>>enter key.
>>
>>Thanks for the help.
>>BrianDH

>
>Add this little script to the page:
>
> <script language="javascript">
> function BlockEnter()
> {
> if (window.event.keyCode == 13)
> {
> window.event.keyCode = 0;
> };
> };
> </script>
>
>And add
>onKeyPress="BlockEnter()"
>to the body tag
>
>Leon.
>.
>

 
Reply With Quote
 
 
 
 
Bob Lehmann
Guest
Posts: n/a
 
      01-12-2005
How is your problem related to Microsoft? The enter key behavior is present
in all modern browsers.

Bob Lehmann

"BrianDh" <> wrote in message
news:213d01c4f8d2$d2b42b20$...
> Thank you!!!!!!!!
>
> Damn microsoft! Now I have to write vb.net, and
> javascript in one app. Yep we are moving forward! ;-D
>
> Thanks
>
> >-----Original Message-----
> >On Wed, 12 Jan 2005 07:45:29 -0800, "BrianDH"
> ><> wrote:
> >
> >>Hi
> >>VB.Net code Behind, Web form.
> >>I am looking for a way to stop my web form application
> >>from firering a button click when the user hits the

> Enter
> >>key.
> >>I only want to button to bubmit, or exit or clear when
> >>they click the button not in random when they hit the
> >>enter key.
> >>
> >>Thanks for the help.
> >>BrianDH

> >
> >Add this little script to the page:
> >
> > <script language="javascript">
> > function BlockEnter()
> > {
> > if (window.event.keyCode == 13)
> > {
> > window.event.keyCode = 0;
> > };
> > };
> > </script>
> >
> >And add
> >onKeyPress="BlockEnter()"
> >to the body tag
> >
> >Leon.
> >.
> >



 
Reply With Quote
 
Anders Matthiessen
Guest
Posts: n/a
 
      01-12-2005
BrianDH wrote:

> I am looking for a way to stop my web form application
> from firering a button click when the user hits the Enter
> key.
>
> I only want to button to bubmit, or exit or clear when
> they click the button not in random when they hit the
> enter key.


If it is because of the buttonorder making trouble, control what is
submitted when pressing enter :

Public Shared Sub SetDefaultButton(ByRef objTextControl As TextBox,
ByRef objDefaultButton As Button)
objTextControl.Attributes.Add("onkeydown", "if (event.keyCode == 13)
{document.getElementById('" + objDefaultButton.ClientID + "').click();
return false;} else return true;")
End Sub
--
/Anders
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
STRUTS- <html:submit> does not submit on pressing Enter key Megha Vishwanath Java 2 10-02-2009 12:52 PM
capturing from text area Shft+Enter, Control+Enter, Alt+Enter and browser issue. HopfZ Javascript 0 08-28-2006 10:11 AM
Form submit - hitting enter does not trigger Submit button ASP General 2 10-25-2004 03:37 PM
STRUTS-<html:submit> -Hitting enter key does not submit the form Megha Vishwanath Javascript 3 07-20-2004 05:45 AM
Textbox and button -- enter key/submit - REFERENCE KathyB ASP .Net 0 07-24-2003 10:24 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57