Enter key to work as a submit button

Discussion in 'ASP .Net' started by Felix_WafyTech, Feb 20, 2006.

  1. 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
     
    Felix_WafyTech, Feb 20, 2006
    #1
    1. Advertisements

  2. Felix_WafyTech

    tdavisjr Guest

    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.
     
    tdavisjr, Feb 20, 2006
    #2
    1. Advertisements

  3. 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, Feb 20, 2006
    #3
  4. Felix_WafyTech

    tdavisjr Guest

    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.
     
    tdavisjr, Feb 20, 2006
    #4
  5. Steven Cheng[MSFT], Feb 21, 2006
    #5
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KathyB
    Replies:
    0
    Views:
    598
    KathyB
    Jul 24, 2003
  2. =?Utf-8?B?U2FuamVlYiBTYXJhbmdp?=

    Default button mapped to the Enter key would be "Submit"

    =?Utf-8?B?U2FuamVlYiBTYXJhbmdp?=, Feb 6, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    835
    Ian Oldbury
    Feb 6, 2004
  3. Megha Vishwanath
    Replies:
    2
    Views:
    10,371
    tutorialsmaster
    Oct 2, 2009
  4. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    654
    Anders Matthiessen
    Jan 12, 2005
  5. M P
    Replies:
    1
    Views:
    841
  6. Guest
    Replies:
    2
    Views:
    1,877
    Guest
    Oct 25, 2004
  7. Matt
    Replies:
    1
    Views:
    742
    Michael Winter
    Mar 6, 2004
  8. Megha Vishwanath
    Replies:
    3
    Views:
    1,001
    Megha Vishwanath
    Jul 20, 2004
Loading...