form submission 
Author Message
 form submission

<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.*-*-*.com/
"From the mouths of babes comes ... slobber."



Mon, 21 Jul 2003 03:20:26 GMT  
 form submission
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."
|
|



Tue, 22 Jul 2003 11:06:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to Cancel Form Submission with VBScript Function?

2. ServerSide ASP Form Submission - Help!

3. Automatic Form Submission by pressing ENTER

4. Resetting a dropdown to the 1st item upon form submission - HELP

5. Form Submission -

6. Form submission

7. Form submission using a <A HREF>

8. help - disabling multiple form submissions

9. Frames and Forms Submission

10. Form submission with the Enter key under Netscape

11. capture selected option value without form submission

12. how to check input on form submission?

 

 
Powered by phpBB® Forum Software