Home | HTML & Style Sheets | Javascript | Downloads | Tip of the Week | Question & Answer | Links | Awards | Contact
 
Preventing the ENTER key from submitting a form
From Microsoft Web Builder

If you use a form on your Web page, the form is submitted if your user hits the [Enter] key, even if you don't have an <INPUT TYPE=SUBMIT> button. This can create a problem if you use a form validation script. To prevent this action, you can define a second form (dummy) on the page. You can leave it empty or use only a hidden input.

For example, place this dummy form after the real form:

<form method=get>
<input type="hidden">
</form>


Back