Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Using onKeyDown with Tab key

    Hi,

    When I do the following in my form:

    EG:
    OnKeyDown="javascript: if(event.keyCode == 9){fieldname.focus()}"

    It tabs to the wrong spot on the form. Likewise when I change the fieldname to any other field name in the form. What I want is to be able to vertically tab down the page so a user can input their data (The inputs are in 2 columns). The left side is a 'bill to' and the right side is a 'ship to'. I want all the bill to stuff filled out first before going to the second column.

    Not exactly sure why this is not working, but any help would be apprecaited. Thanks.

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try defining tabindex attributes for the elements.
    Thanks in advance!

  • #3
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well that did it. Thanks for the advice, didn't realize it was that easy.

    On a side note, I think it's lame that the tab key is so gosh darn hard to define with JavaScript. Oh well, thanks!

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On that note, controlling the event return value is key.
    Code:
    onkeydown="return event.keyCode == 9 ? fieldname.focus() || false : true"
    Thanks in advance!


  •  

    Posting Permissions

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