ASP.NET 2 Enter Key and master page

G

Guest

Hi there,

I'm using framework 2 and web site application with master page and more
than 30 pages used master. I have users come from desktop application who
like to hit Enter every time they entered some things in the textbox. I would
like to disable the Enter Key for this application. Any ideas how to disable
enter key for the whole application.

Thanks.
 
N

Nail

Add following attribute to the BODY tag of the masterpage:

onkeydown="javascript:if(event.keyCode==13){event.keyCode=9;}"

You should get something like this:

<body onkeydown="javascript:if(event.keyCode==13){event.keyCode=9;}">
....
</body>

It will change ENTER key behavoiur - it will work as TAB key.
 
D

darrel

Thank you very much. It's working beautiful.

But that's a horrible solution.

Enter = form submit is a basic function of a web browser. This isn't an
application issue, it's a user training issue.

Disabling the enter key may placate the uneducated users, but it's going to
infuriate any power user and also makes your site that more inaccessible.

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top