disabling the ENTER button to trigger a button?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've got an online form, with textboxes and drop downs and at the end
a SUBMIT button.

My users are used to hitting ENTER to move from field to field, and
right now if they hit ENTER, the button is executed, or the .php page
post action is executed.

Is there a way to disable this so the only way the post action will
occur is if the button is clicked? how?


Re: disabling the ENTER button to trigger a button?

Scripsit paul814@excite.com:

Quoted text here. Click to load it

They have to learn to abandon such habits when filling out forms on the
web, since in most situations, Enter submits the form.

Do you want to slow down their learning process?

Quoted text here. Click to load it


Not really, and you don't want that. What would those people do who have
no mouse to click with or have some disability that prevents them using
the mouse "normally"?

But taking "clicking" abstractly enough, it's a reasonable goal, but
it's possible to a limited extent only.

This used to be a FAQ, in the old days when FAQs flourished, the climate
was mild and pleasant, people acted reasonably etc. You could still dig
up some dusty old FAQ and follow some links and finally find this:
which explains:

Include the following element into the head part of your document:

<script type="text/javascript">
function noenter() {
  return !(window.event && window.event.keyCode == 13); }

Add the following attribute into each input type="text" tag(s) in your
onkeypress="return noenter()"

It might just work, part of the time.

Jukka K. Korpela ("Yucca")

Site Timeline