Invoke code behind image-button with <Enter> key from anywhere on form

Discussion in 'ASP .Net' started by Paul W, Apr 30, 2005.

  1. Paul W

    Paul W Guest

    On my simple login-screen I have a 'username' and 'password' field and an
    imagebutton for the 'OK'.

    This used to work nicely so that when the user hit <Enter> from the password
    field, it invoked the VB code behind the image-button, and away he went.
    Suddenly this has stopped working like this. It still works if you use the
    mouse to click on the button, or first TAB to it, then click <Enter>.
    However, if you now hit <Enter> with the cursor still in the 'password'
    field it submits the form, runs Page_Load, but doesn't call the
    image-button's click event.

    A 'working' version is at
    http://www.mystictennisbookings.com/admin/login.aspx . FYI - what I did that
    seemed to break it was to replace the Textbox webcontrol that I used for the
    'Username' field with a Dropdown webcontrol.

    Any ideas how I can restore the required functionality? Thanks,

    Paul.
     
    Paul W, Apr 30, 2005
    #1
    1. Advertising

  2. Patrick Olurotimi Ige, May 1, 2005
    #2
    1. Advertising

  3. Paul W

    Paul W Guest

    The link I sent is to the original version that works as desired - hitting
    <Enter> from the password field here will invoke the code behind the
    image-button.

    There's a copy of the version that does NOT work at
    www.mystictennisbookings.com/admintest/login.aspx - here if you hit <Enter>
    from the password field it submits the form but doesn't execute the
    image-button event.

    Paul.

    Paul.
    "Patrick Olurotimi Ige" <> wrote in message
    news:e$...
    > So are using a DropDown webcontrol for the Username box on this page at
    > http://www.mystictennisbookings.com/admin/login.aspx ?
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
     
    Paul W, May 1, 2005
    #3
  4. RE: Invoke code behind image-button with <Enter> key from anywhere on

    "Paul W" wrote:

    > On my simple login-screen I have a 'username' and 'password' field and an
    > imagebutton for the 'OK'.
    >
    > This used to work nicely so that when the user hit <Enter> from the password
    > field, it invoked the VB code behind the image-button, and away he went.
    > Suddenly this has stopped working like this. It still works if you use the
    > mouse to click on the button, or first TAB to it, then click <Enter>.
    > However, if you now hit <Enter> with the cursor still in the 'password'
    > field it submits the form, runs Page_Load, but doesn't call the
    > image-button's click event.
    >
    > A 'working' version is at
    > http://www.mystictennisbookings.com/admin/login.aspx . FYI - what I did that
    > seemed to break it was to replace the Textbox webcontrol that I used for the
    > 'Username' field with a Dropdown webcontrol.
    >
    > Any ideas how I can restore the required functionality? Thanks,
    >
    > Paul.
    >
    >
    >
     
    =?Utf-8?B?c2UtbWFydGVu?=, Jul 15, 2005
    #4
  5. Re: Invoke code behind image-button with <Enter> key from anywhere on

    Paul,

    what you basically have to do is to assign a tiny js function to the keydown
    event of your password input field which will trigger the ok.click.

    HTHs

    Daniel

    "se-marten" <> schrieb im Newsbeitrag
    news:...
    >
    >
    > "Paul W" wrote:
    >
    >> On my simple login-screen I have a 'username' and 'password' field and an
    >> imagebutton for the 'OK'.
    >>
    >> This used to work nicely so that when the user hit <Enter> from the
    >> password
    >> field, it invoked the VB code behind the image-button, and away he went.
    >> Suddenly this has stopped working like this. It still works if you use
    >> the
    >> mouse to click on the button, or first TAB to it, then click <Enter>.
    >> However, if you now hit <Enter> with the cursor still in the 'password'
    >> field it submits the form, runs Page_Load, but doesn't call the
    >> image-button's click event.
    >>
    >> A 'working' version is at
    >> http://www.mystictennisbookings.com/admin/login.aspx . FYI - what I did
    >> that
    >> seemed to break it was to replace the Textbox webcontrol that I used for
    >> the
    >> 'Username' field with a Dropdown webcontrol.
    >>
    >> Any ideas how I can restore the required functionality? Thanks,
    >>
    >> Paul.
    >>
    >>
    >>
     
    Daniel Walzenbach, Jul 15, 2005
    #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. Greg H
    Replies:
    1
    Views:
    439
    David Waz...
    Jul 3, 2003
  2. Olav Tollefsen

    Enter key to invoke button event handler?

    Olav Tollefsen, Jan 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    633
    Alvin Bruney
    Jan 24, 2004
  3. bsm
    Replies:
    0
    Views:
    1,317
  4. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    410
    Anders Matthiessen
    Jan 12, 2005
  5. bsm
    Replies:
    3
    Views:
    288
Loading...

Share This Page