Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change enter key to "Not Submit" form 4

Status
Not open for further replies.

chilly442

Technical User
Jun 25, 2008
151
0
0
US
I have a web form with dropdown boxes that users select from. No matter where you are in the form, if the enter key is pressed, it takes the user back to the Login Screen. I just want the enter key to do nothing, and force the user to click the "Submit" button on the page.

I have tried to use some of the code that I found on line, but no success. I still end up back at the Login Screen.

Any ideas?
Help gets you stars!
Thanks,
Chilly442
 
I am not sure why it does that for me I have this code and when the user click the enter key it submits the form.

check if you code has this line and remove it form there
defaultbutton="btnSearch

<form id="form1" runat="server" defaultbutton="btnSearch">
 
That is not it. I don't have that line in my code.

Thanks for the post. Any other ideas?

Chilly442
 
Apart from the "Submit" button, do you have any other buttons on your page (for example a "Back" button)?

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Chilly:
Did you ever get this to work?
I have exactly the same issue.
Thanks.
 
No other buttons. Just the "Submit" button. I have tried everything that I can find to solve this problem, and nothing has worked.

Looks like others are having the same issue.
Please guide us in the right direction.

Thanks,
Chilly442
 
After a bit more searching I found this:
Code:
TextBox1.Attributes.Add("onkeydown", "return (event.keyCode!=13);")
If placed in the PageLoad it takes care of my problem.

Thanks to all who tried to help.

Sorry it took so long to post this.

Thanks,
Chilly442
---------------------------------------
If I lived anywhere else I'd be Sunny442
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top