Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Form Submission

Posted on 2006-07-13
Medium Priority
Last Modified: 2010-04-09
Hi all

Why a form with single text box gets submitted when pressing enter key,
Below I have given the code, click on the text box and press enter key,
the form gets submitted.. why??

<form name="testing">
<input type="text">

Question by:sumachaa
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 18

Expert Comment

ID: 17098642
LVL 13

Expert Comment

ID: 17099820
Most browsers will automatically submit a form when the enter key is pressed. Usually they dont if theres no "submit" button but it will all depend on the browser your using.
LVL 12

Expert Comment

ID: 17104168
My fellow experts may be correct, but I'm gonna assume that the problem lies in that it's an <input> tag and get's set as the default.  Try adding default="false" to your input type="text".  I'm probly crazy!

...uhhhh, strike that, I'm definatly crazy, worth a try though.


Author Comment

ID: 17105859
Hi all

I dont want to know the way how to submit the page. I would like to know if there is any specific reason for this, (why the page gets submitted when one text box is there)

This happens in both IE and firefox.

If I add one more text box, this wont happen, ie... pressing enter key will not submit the page

<form name="testing">
<input type="text"><br>
<input type="text">
LVL 17

Accepted Solution

gops1 earned 80 total points
ID: 17107834
When filling out a form, most browsers will cause the form to be submitted if the user's focus is within a single textbox and they hit the Enter key. The specifics of this interaction vary from browser to browser. Some older browsers don't cause a submission upon hitting Enter; others older browser only do it if there is precisely one input form field. Modern browsers, however, all pretty much support the Enter acting as form submission, but even then they still exhibit some slight differences.

The URL below  provided short description on how the Enter key should affect form submission:

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

688 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