Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Enter key to work as a submit button

Reply
Thread Tools

Enter key to work as a submit button

 
 
Felix_WafyTech
Guest
Posts: n/a
 
      02-20-2006
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


 
Reply With Quote
 
 
 
 
tdavisjr
Guest
Posts: n/a
 
      02-20-2006
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.

 
Reply With Quote
 
 
 
 
blackstaronline.net
Guest
Posts: n/a
 
      02-20-2006
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

 
Reply With Quote
 
tdavisjr
Guest
Posts: n/a
 
      02-20-2006

blackstaronline.net wrote:
> 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.

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-21-2006
Here are some other articles discussing on provide a default button(use
script with key press event)

http://www.metabuilders.com/tools/DefaultButtons.aspx

http://www.allasp.net/enterkey.aspx

http://www.beansoftware.com/ASP.NET-...Enter-Key.aspx

Hope also helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
STRUTS- <html:submit> does not submit on pressing Enter key Megha Vishwanath Java 2 10-02-2009 12:52 PM
Enter Key H*ll, control enter key submit button BrianDH ASP .Net Web Controls 3 01-12-2005 08:29 PM
Form submit - hitting enter does not trigger Submit button ASP General 2 10-25-2004 03:37 PM
STRUTS-<html:submit> -Hitting enter key does not submit the form Megha Vishwanath Javascript 3 07-20-2004 05:45 AM
trigger HTML button by enter ENTER key Matt Javascript 1 03-06-2004 07:01 PM



Advertisments