Form submitting and the enter key

Posted on 1998-06-27
Last Modified: 2010-04-09
I was just wondering why sometimes when  you hit enter on a form, it submits it, and other times it doesn't (plays an error sound or something like that).  Also if something in the form causes this, is it the same on all the browsers, or are there different behaviors for the different browsers as well (and what are they).
Question by:jbirk
LVL 28

Expert Comment

ID: 1844422
The enter key submits the form when there is only one textfield (and a submit button), in other cases it plays the error sound.


Author Comment

ID: 1844423
That's not right...  focus on the text field on this page which says "increase points to:"
Then hit enter.  On Netscape 3 and 4, it submits the form, and there are 4 fields for this form.

On IE 4, it also submits on the text field AND the checkbox field (below) when hitting enter (after focusing on those fields).

Expert Comment

ID: 1844424
sybe had it right, sort of. Netscape blocks Enter as Submit if there if multiple *text* fields.What matters to Netscape on the page you mention is there is only one text field - none of the other fields are <input type=text> fields. (The comment area is a textarea).

There is no official "standard" on this, it is purely up to the browser designer. Other browsers like IE do it a little differently, as you observed. I think the general idea is to make it easier for people to submit yet to keep them from accidentally submitting before they are done filling out the form.

I wouldn't be surprised if some beta tester back in the pre-Netscape days of Mosaic had submitted feedback that led to this feature, and it has lived on, being tweaked periodically by browser designers trying to make it more useful.
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why


Author Comment

ID: 1844425
Thank you Alamo.  Answer the question, and I'll give you the points.

Expert Comment

ID: 1844426
The error sounds on IE4 on NT. Not on 95/98. No matter what the form is.

As for Netscape, Alamo is right.

Author Comment

ID: 1844427
I had intended for alamo to get the points (few though they may be).  Besides, what I wanted was info about when hitting enter works, not when it makes an error sound.  Alamo answered that for me.

Please answer the question alamo.

Accepted Solution

alamo earned 10 total points
ID: 1844428
Thanks, jbirk!

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question