hitting "enter" on a page

Discussion in 'ASP .Net' started by MattB, May 24, 2004.

  1. MattB

    MattB Guest

    I have a WebForm that has a "reset" button and an "Enter" button. It's a
    long form, and users tend to hit the enter key at some point when they
    really want to tab to the next form field. How can I control this default
    behavior? I figured I could have an "are you sure?" confirmation if fields
    are blank, but I think I'd just rather make it so enter doesn't submit the
    form.
    Any examples or suggestions for me? Thanks!

    Matt
    MattB, May 24, 2004
    #1
    1. Advertising

  2. You can intercept the client side enter keypress event of the text box and
    then do what you want using javascript code.
    Here's a good example:
    http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=18

    You could also try using this free control.
    http://www.metabuilders.com/tools/DefaultButtons.aspx

    And here's a couple good articles on the subject:
    http://www.allasp.net/enterkey.aspx
    http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net



    "MattB" <> wrote in message
    news:...
    > I have a WebForm that has a "reset" button and an "Enter" button. It's a
    > long form, and users tend to hit the enter key at some point when they
    > really want to tab to the next form field. How can I control this default
    > behavior? I figured I could have an "are you sure?" confirmation if fields
    > are blank, but I think I'd just rather make it so enter doesn't submit the
    > form.
    > Any examples or suggestions for me? Thanks!
    >
    > Matt
    >
    >
    Steve C. Orr [MVP, MCSD], May 24, 2004
    #2
    1. Advertising

  3. MattB

    MattB Guest

    Perfect. Thanks!

    Matt

    Steve C. Orr [MVP, MCSD] wrote:
    > You can intercept the client side enter keypress event of the text
    > box and then do what you want using javascript code.
    > Here's a good example:
    > http://www.kamp-hansen.dk/pages/showdoc.asp?id=28&menuid=21&menuid=18
    >
    > You could also try using this free control.
    > http://www.metabuilders.com/tools/DefaultButtons.aspx
    >
    > And here's a couple good articles on the subject:
    > http://www.allasp.net/enterkey.aspx
    > http://www.aspnetpro.com/features/2004/06/asp200406so_f/asp200406so_f.asp
    >
    >
    > "MattB" <> wrote in message
    > news:...
    >> I have a WebForm that has a "reset" button and an "Enter" button.
    >> It's a long form, and users tend to hit the enter key at some point
    >> when they really want to tab to the next form field. How can I
    >> control this default behavior? I figured I could have an "are you
    >> sure?" confirmation if fields are blank, but I think I'd just rather
    >> make it so enter doesn't submit the form.
    >> Any examples or suggestions for me? Thanks!
    >>
    >> Matt
    MattB, May 24, 2004
    #3
    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. Nate Hekman

    Hitting Enter in a textbox

    Nate Hekman, Sep 23, 2004, in forum: ASP .Net
    Replies:
    9
    Views:
    485
    Matt Berther
    Sep 23, 2004
  2. Andy G

    Hitting the enter key

    Andy G, Dec 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,543
    Andy G
    Dec 28, 2004
  3. Sunfire
    Replies:
    2
    Views:
    1,048
    Sunfire
    Nov 6, 2007
  4. Abraham Luna

    hitting enter does not submit form but refreshes page?

    Abraham Luna, Sep 2, 2005, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    321
    Abraham Andres Luna
    Oct 27, 2005
  5. HopfZ
    Replies:
    0
    Views:
    541
    HopfZ
    Aug 28, 2006
Loading...

Share This Page