1. Home
  2. Computing & Technology
  3. Web Design / HTML

How do I make a form so it can be submitted by hitting ?

By Jennifer Kyrnin, About.com

Question: How do I make a form so it can be submitted by hitting <ENTER>?

Answer:

If your form has only one text field then your customers will be able to hit the <ENTER> key and submit the results. This includes other form fields such as radio buttons or drop-down lists.

Common Problems on Hitting the <ENTER> Key

If you have multiple forms on one page, you may experience problems with the <ENTER> key. If the browser isn't sure which form to submit the data to, you might get erratic results.

Also, if your form is submitted via a button using JavaScript, you need to make the button actually submits the form through the form action attribute, rather than sending data through an onclick attribute of the button. When you hit the <ENTER> key, the form is submitted using the action attribute or any onsubmit attributes of the form tag.

Free HTML Forms Class
HTML Forms Tutorial
Help with HTML Forms
More on form tags

More Web Design / HTML Q&A

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. Forms
  7. How do I make a form so it can be submitted by hitting ENTER?

©2008 About.com, a part of The New York Times Company.

All rights reserved.