Enter key to work as a submit button

  • Thread starter Thread starter Felix_WafyTech
  • Start date Start date
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
 
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.
 
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
 
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.
 
Back
Top