Avatar

Level 4

Hi there,

There is one way to remove buttons completly from the tab order. It takes a bit of work to acheive, but I do this for all of my forms... In the exit event of all fields that I wish to tab through, I include the following code:

if (xfa.event.commitKey == 3) then

     xfa.host.setFocus("NextFieldsSOM")

endif

What the above says is 'If the person is leaving this field by pressing tab, then set the focus to the field at NextFieldsSOM (Where NextFieldsSOM is the relative or absolute reference to the next field).

This completely overrides the tab-order that the form would otherwise decide to use. The reason why I do this is that I've noticed that some forms, especially dynamic forms with repeatable subforms, refuse to tab as I specify using the built-in tab-order mechanism. Doing this allows me to programmatically decide which field should be tabbed through first.

You can use a combonation of the two methods (manual & programmatic), just using the code to specify the tab order for things where you wish to override the natural order of things. I personally set the tab order progammatically for the entirety of all my forms. The level of control that this allows me far outweighs (in my oppinion) the amount of effort this takes.

For example, in the last field of a repeatable subform, I need to check to see if there is another 'copy' of the subform below. If there is, I should tab to the first field in the next instance of the repeated subform, if not, I need to tab to the next area. To do this, I use some code similar to:

if (xfa.event.commitKey == 3) then

     if ($.parent.instanceIndex < $.parent.instanceManager.Count - 1) then

          xfa.host.setFocus(concat("$.parent.parent.sf_repeatable[", $.parent.instanceIndex + 1, "].FirstFieldName"))

     else

          xfa.host.setFocus("$.parent.parent.sf_nextSection.FirstFieldOfNextSectionName")

     endif

endif