html form - disable submit on hitting enter key

dsfunk

Golden Member
May 28, 2004
1,246
0
0
How do you disable submitting the form when the Enter key is pressed?

Also, Is it possible to make Enter act as Tab to go through the fields?
 

torpid

Lifer
Sep 14, 2003
11,631
11
76
Why would you want to do either of these? Hitting enter to tab is just a horrible idea. That is breaking a fundamental understanding of how forms work in web pages.

Disabling submit on enter is silly too. Disabling submit on submit, well THAT makes sense if you want a simplistic way of preventing double submits.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Originally posted by: torpid
Why would you want to do either of these? Hitting enter to tab is just a horrible idea. That is breaking a fundamental understanding of how forms work in web pages.

Disabling submit on enter is silly too. Disabling submit on submit, well THAT makes sense if you want a simplistic way of preventing double submits.

Custom web applications may require either of these features.

For a general web page, I agree, it's a bad idea.
 

edmicman

Golden Member
May 30, 2001
1,682
0
0
We disabled "enter" to submit on a form clients fill out to request info from our company. for some odd reason, tons of people were entering info, then hitting "enter" to go to the next field, and it would submit partially, then they'd have to go back and add everything else they wanted to. I can't see replacing the "tab" functionality with the "enter" key, but I do see a reason to force them to actually click on "submit" to submit the form. Just my $.02.
 

dsfunk

Golden Member
May 28, 2004
1,246
0
0
I agree Tab would be the preferred way of using the form. However, this application is replacing an old application, and it will act just like the original.

I have another question. I am using the code that Mr. Chad linked to. This works great, except for one thing. How can I get the 'Enter' key presses to follow the Tab Index? They ignore it currently.