Results 1 to 6 of 6

Thread: how to submit a form when enter is pressed

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    32

    how to submit a form when enter is pressed

    Code:
    <form id="Form1" method="post" runat="server">
      <asp:textbox id="TxtEmail" tabIndex="1" runat="server" Width="272px" ToolTip="Enter your emailaddress for authentication"></asp:textbox>
      <asp:textbox id="TxtPassword" tabIndex="2" runat="server" Width="272px" ToolTip="Enter your domain password" TextMode="Password"></asp:textbox>
      <asp:linkbutton id="BtnLogin" tabIndex="3" runat="server">Login</asp:linkbutton>
    </form>
    This is the form as i use it for my user to enter thier login information. But now they have to click the link in order to log in. Is it possible to submit the form when 'enter' is pressed (like it's the case with input type="submit" in standard html forms).

    does anyone know how to do this?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: how to submit a form when enter is pressed

    Add an invisible HTML Textbox in there

    Code:
    <input type="text" style="display:none">

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    32

    Re: how to submit a form when enter is pressed

    doesn't seem to be working

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: how to submit a form when enter is pressed

    Sorry,

    that should be

    Code:
    <input type="submit" style="display:none;">

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    32

    Re: how to submit a form when enter is pressed

    i already tried it it, but without succes

  6. #6
    Junior Member
    Join Date
    Mar 2004
    Posts
    22

    Re: how to submit a form when enter is pressed

    Put your logic in Page_Load (if postback). By hitting enter, the page will refresh and log your user in.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width