Closed Panman82 closed 10 years ago
I believe you could do that by adding target and previous property. Something like:
$( '#inputA' ).autotab({target: "#inputB"}); $( '#inputA' ).autotab({target: "#inputC", previous: "#inputA"}); $( '#inputA' ).autotab({previous: "#inputB"});
Check out the documents and correct if i'm wrong.
As @bboyz269 pointed out, if you want to define each textbox individually, you have to specify the target
and previous
elements. Doing them individually requires more work, but allows you to define what filtering rules to apply. However, if they all share the same rules, or no filtering is not needed, then using a selector that matches all applicable elements is more efficient. In a situation where fields can be added or removed, I'd put the responsibility on the developers plate in updating any existing definitions, though I'm not opposed to seeing if I could add similar logic to Autotab itself. Anyway, Autotab has a number of ways to define settings for inputs, you can see in demo.html. Speaking of which, I really need to get a live version up.
This does bring up a possible feature, however. Perhaps .autotab()
could automatically detect the previous and next logical elements, and calling .autotab(false)
would prevent it. It will have to consider tab index, and could possibly be hampered by how I'm able to work with form elements.
Now that I understand how it works, it's not a big deal. Sure, I understand that you can specify the next and previous target, but it would be nice if Autotab would just know the order that they are initialized and connect them.
My thoughts were that Autotab would somehow know the connection based on the order they were initialized (and/or perhaps the tab order). What if the previous/target options had a boolean true option that would connect multiple.?. Internally Autotab would have a reference to the latest initialized object. Then if the next time Autotab is called with prevous: true autotab would set the previous to the previously initialized object. And similarly the target.
If this isn't clear I can certainly try to put a code example together. This is just a thought and not critical to anything I need, so if it's not worth putting together then feel free to close this ticket (no hurt feelings here).
At first I was confused why autotab wasn't working, then I realized that "tabbed" fields needed to be selected/initialized at the same time.
It would be great if there was a way to "connect" all separately initialized fields. This way dynamically added elements could be .autotab()'ed and automatically be included into the "tab group". Perhaps some sort of global autotab setting.