Re: Dynamically setting tabindex for input elements in a component
Perfect, thanks On Mon, Sep 27, 2010 at 6:44 PM, Thiago H. de Paula Figueiredo < thiag...@gmail.com> wrote: > On Mon, 27 Sep 2010 14:09:18 -0300, Denis McCarthy < > dmccar...@annadaletech.com> wrote: > > > t:label="message:COUNTRY" tabindex="${tabIndexStart + 1}" /> >> > > t:label="message:COUNTRY" tabindex="${getTabIndex(1)}" /> > > public int getTabIndex() { > > } > > > public int getTabIndex(int skip) { >getTabIndex() + skip; > } > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Annadale Technologies Limited
Re: Dynamically setting tabindex for input elements in a component
On Mon, 27 Sep 2010 14:09:18 -0300, Denis McCarthy wrote: public int getTabIndex() { } public int getTabIndex(int skip) { getTabIndex() + skip; } -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Dynamically setting tabindex for input elements in a component
So, your component contains 70+ inputs and I guess it's included in pages more than once... If you're happy with the default taborder within one render of your component (and you don't need to manually tweak it), then just set the taborder in all your inputs to be the same number. And then, on the next render of the component, inc the taborder but still use the same in all inputs. That should work because elements that have identical tabindex values are navigated in the order they appear in the html file. On Mon, Sep 27, 2010 at 20:09, Denis McCarthy wrote: > Hi I have a pretty large component that needs to appear in one of two places > in a large form, depending on who's using the form. The dynamic placement I > can do pretty easily using delegates. However, I'm struggling with the > tabindex of the various input elements in the component. I want them to vary > (depending on where the component is actually rendered) so the user can > seamlessly tab through this large form, regardless of where this particular > component is rendered. > > Now, a naive implementation would be to simply have a server side method per > tabindex, like > t:label="message:COUNTRY" tabindex="${countryTabIndex}" /> > > This will work. However, I have 70+ input elements in this form, and adding > 70+ getters like this hurts my brain. Is there some nicer way to do this? I > don't think having a single getter with side effects is going to work either > (like this: > > getNextComponentTab() { > nextTab ++; > return Integer.parseInt(nextTab); > } > t:label="message:COUNTRY" tabindex="${nextComponentTab}" /> > > Because the getter is called a couple of times during page render, so I'd > end up missing numbers in the tab index order - this itself doesn't break > the tabbing of course, but it causes an overlap with subsequent elements in > following components. If there was some way I could do the arithmetic in the > tag itself, e.g. > > t:label="message:COUNTRY" tabindex="${tabIndexStart + 1}" /> > > Then I'd settle for that, but that isn't possible I don't think. > > Any ideas greatly appreciated. > Denis > -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry PMC / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Dynamically setting tabindex for input elements in a component
Hi I have a pretty large component that needs to appear in one of two places in a large form, depending on who's using the form. The dynamic placement I can do pretty easily using delegates. However, I'm struggling with the tabindex of the various input elements in the component. I want them to vary (depending on where the component is actually rendered) so the user can seamlessly tab through this large form, regardless of where this particular component is rendered. Now, a naive implementation would be to simply have a server side method per tabindex, like This will work. However, I have 70+ input elements in this form, and adding 70+ getters like this hurts my brain. Is there some nicer way to do this? I don't think having a single getter with side effects is going to work either (like this: getNextComponentTab() { nextTab ++; return Integer.parseInt(nextTab); } Because the getter is called a couple of times during page render, so I'd end up missing numbers in the tab index order - this itself doesn't break the tabbing of course, but it causes an overlap with subsequent elements in following components. If there was some way I could do the arithmetic in the tag itself, e.g. Then I'd settle for that, but that isn't possible I don't think. Any ideas greatly appreciated. Denis