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

jeff jeff at members.evolt.org
Mon Dec 4 04:18:26 CST 2000


tab,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Tab Alleman
:
: Ok, so if a non-js user submits a form that has
: onsubmit() validation, the validation would just
: get ignored and the form would submit normally,
: right?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

correct - the default behavior for ie4+ users (70 - 90% of the internet's
total users).  my point being that these users are expecting a certain
behavior when clicking the enter key.  take that away and you've muddied the
waters for them.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Well, that wouldn't solve the original question of
: how to disable the <enter> key for form submission,
: so I guess the consensus is that you can't, without
: JavaScript.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

true - if you want the form to be usable by all then you can't disable the
enter key.  plain and simple.  it still boggles my mind why there's so much
energy being spent on disabling a common element in the user-interface.  it
seems to me that things like that should be considered sacred and not toyed
with.

don't you find it frustrating when a site thinks you should surf it's
contents in a popup?

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: For purposes of answering that specific question, I
: like my solution better than Jeff's, because Jeff's will
: pop up some alert box telling the user they didn't fill
: out some field before they (accidentally?) hit <enter>,
: and mine will simply ignore the <enter> key altogether.
: But I agree that caution should be exercised before
: deciding to use my method, as it may do more harm
: than good in some cases.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

so mine pops up an alert() when you hit the enter key (as it does in ie4+ on
every other site that you visit that uses form validation with the onSubmit
event handler) and yours only does it when you have to move your hands from
the keyboard to the mouse to click the submit button?  in the end how much
different are they except that yours deviates from standard practice,
disables an element of the user interface, and requires extra effort (moving
the hand from the keyboard to the mouse)?

i see the point that you're trying to make - the disabling of the enter key.
however, that's the very point that i'm talking about as well.  you should
*not* disable the enter key because that's part of the user interface -
especially when that solution alienates non-js users entirely (an even worse
problem than an occasional form submitted early).

maybe i'm being a bit blunt but i think your solution (while it certainly
addresses the scope of the original request) will always do more harm than
good and should never be used.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: (jeez, see if I ever try to leave a tip around here again...)  ;)
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

no, please do.  it's information that helps everyone.  you specifically
answered the question of another list member who was struggling with that
problem while on the same hand exposed an aspect of the user interface and
our interaction with it via javascript that needed to be discussed.

thanks,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org





More information about the thelist mailing list