hitting "enter" on a page

M

MattB

I have a WebForm that has a "reset" button and an "Enter" button. It's a
long form, and users tend to hit the enter key at some point when they
really want to tab to the next form field. How can I control this default
behavior? I figured I could have an "are you sure?" confirmation if fields
are blank, but I think I'd just rather make it so enter doesn't submit the
form.
Any examples or suggestions for me? Thanks!

Matt
 
S

Steve C. Orr [MVP, MCSD]

M

MattB

Perfect. Thanks!

Matt
You can intercept the client side enter keypress event of the text
box and then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top