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. Advertising

  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. Advertising

  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. Advertising

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. Megha Vishwanath
    Replies:
    2
    Views:
    9,798
    tutorialsmaster
    Oct 2, 2009
  2. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    369
    Anders Matthiessen
    Jan 12, 2005
  3. M P
    Replies:
    1
    Views:
    453
  4. Matt
    Replies:
    1
    Views:
    494
    Michael Winter
    Mar 6, 2004
  5. Megha Vishwanath
    Replies:
    3
    Views:
    682
    Megha Vishwanath
    Jul 20, 2004
Loading...

Share This Page