Enter key to work as a submit button

F

Felix_WafyTech

Hi,

I have a web form with multipe edit boxes and a submit button. When the
enter key is pressed within one of the editboxes I would like the form to be
submitted. How do I achieve this? Any help is greatly appreciated.

Thanks!
Felix.J
 
T

tdavisjr

If using Asp.net 2.0 the <form> tag as a defaultButton attribute you
can set that to the ID of the button and when the user presses enter
that button will fire.
 
B

blackstaronline.net

But that means if you are using a multi-line text area, the user will
not be able to put in "vbcrlf" and you may have lots of pre-mature form
submissions from people using the ENTER key to add a new line.


Jeremy Reid
http://blackstaronline.net/hgtit
 
T

tdavisjr

blackstaronline.net said:
But that means if you are using a multi-line text area, the user will
not be able to put in "vbcrlf" and you may have lots of pre-mature form
submissions from people using the ENTER key to add a new line.


Jeremy Reid
http://blackstaronline.net/hgtit

I would think if you are within a control like the textarea and you
want to go to a new line, pressing enter shouldn't submit the form. I
would only think the form should submit if no form control currently
has focus. Then again, I could be wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top