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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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.
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users


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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

627 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