[thelist] dHTML Form Elements && tip re: Disabling the <enter> key to submit a form.

Tab Alleman talleman at autobex.com
Fri Dec 1 13:56:31 CST 2000


In my experiences, it seems that there's a percentage of users who grew up
with older browsers and haven't gotten used to the fact that the <enter> key
can submit a form, and there's a percentage who does expect the <enter> key
to submit a form.  Gradually the balance will swing from the former to the
latter... BUT!  the original poster asked how to disable to <enter> key..
the most likely reason for this is that in her specific instance, it's
better to force the user to click submit than to allow them to accidentally
submit the form by hastily pressing <enter> (something *I* still do when I'm
trying to hurry through a long form).  Philosophically, I often agree with
her.  Although both are annoying, I feel a little less annoyed when I
deliberately hit <enter> and the form doesn't submit, forcing me to click
"Submit" than I do when I mistakenly hit <enter> instead of <tab> and I get
an alert saying "You forgot to enter your name, dummy!" or, worse, the form
*does* submit and I just put my car up for sale for $0.00.

(original poster..sorry if I just put the wrong words in your mouth)


-------------------
	Part of that harm could be that people come to expect the enter key
to submit a form, and are confused when it doesn't work. You might well be
creating a new usability issue, and not merely solving an existing one,
perceived or real. And since it doesn't appear that you can prevent the
enter key from submitting a form without using scripting, IMO it is better
to catch missing fields in an onsubmit even handler and alert the user. That
way you still prevent premature form submission without interfering with the
default behavior of the browser.





More information about the thelist mailing list