Like most [OK] buttons in dialogs, the submit button is the "default"
control for a form (as indicated by the dark, thin rect surrounding the
button). Thus, when the [Enter] key is pressed, the default control
(i.e., the submit button) is clicked.
To prevent this, change the type="submit" to type="button" in the
<input> tag, then write an onclick() event handler for the button that
calls the form's submit() method. Something like this:
<input type="button" value="Submit" onclick="document.all['formID'].submit()">
Once you change the submit button to a standard button with an onclick
event handler, then you can change your other text input field back to:
<input type="text" name="mytextbox">
Hope this helps,
-Jim Rofkar.
| <input type="text" name="mytextbox" onkeydown="if (event.keyCode == 13)
| {return false;}">
|
| If I hit enter in this field it still submit's the form.
|
| Any idea why?
|
| --
| Anthony Sullivan MCP, GMT, GST
| Analyst/Programmer
| Ajilon Services, Inc
|
| Check out the ASP FAQ! http://www.aspfaq.com
| "From the mouths of babes comes ... slobber."
|
|