A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: 'Tabbing' input textboxes.

  1. #1
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017

    'Tabbing' input textboxes.

    I am having a problem tabbing through some input text boxes that i have on a site im designing.

    The structure is like this:
    Code:
     _________     _______     _____________
    | login box |   | submit |   | password box |
    What's happening when I tab, is that it will go from login to 'submit' but never go to 'password box'. is there a way to change this order? Whether it goes from login to PW, then to submit, or whether it will just tab login, submit, PW.

    Any insight would be appreciated,
    DavuLf

    edit: it has better graphics in flash

  2. #2
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    Create a tab index of the items you want in focus and the order of the focus when the tab key is pressed...

    code:

    loginInstanceName.tabIndex=1;
    submitInstanceName.tabIndex=2;
    passwordInstanceName.tabIndex=3;


  3. #3
    Mental Ward Patient Blips's Avatar
    Join Date
    May 2005
    Posts
    482
    oh thats how u do it, i was also wondering how u set up the tabbing.

  4. #4
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    NTD you're a genius. Thanks a bunch for that.

  5. #5
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Another quick point to ask, is there a way to make it so when you've tabbed to the submit button, that by hitting enter it will go (or if you just hit enter in general it will go?)

  6. #6
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Go where? To the next textbox in the tabIndex list? You can use the setFocus method for something like that.....

    This demo uses onKeyUp(cause I am feeling lazy and I already have something like this in another demo)....
    you can extend it to the enter key
    code:

    t2=myTextFieldInstanceName;
    myListener= new Object();
    myListener.onKeyUp = function () {
    Selection.setFocus(t2);
    }
    Key.addListener(myListener);


  7. #7
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    I'm not sure I grasp how that works, but that isn't the point.

    If you ever fill out a form via html or php, when you hit enter the submit button posts the variables/checks them and comes back.

    My 'go' button does the same thing. So I've set it up so I tab UN, PW, go. Now, what I want to do is after I've typed in a password, if I hit 'enter' then it will submit the values (ie, click on the 'go' button). I suppose I could have an if statement with setFocus on the password box, and if the keypress is enter, then it acts like the submit button, but I'd rather go through the button itself.

  8. #8
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi,

    I misunderstood what you were after. In the button release code, add keypress"<enter>"....

    code:

    on(release, keyPress "<Enter>"){
    //do something;
    }


  9. #9
    the friendly canadian DaVulf's Avatar
    Join Date
    Feb 2004
    Location
    Singapore
    Posts
    2,017
    Okay cool, thanks NTD.

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

HTML5 Development Center