Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Set Tab Order with JavaScript?

Explorer ,
Jan 19, 2018 Jan 19, 2018

I have written a custom action script to add checkbox fields to my form headers. Everything is working fine, but the checkbox fields are added to the end of the tab order. I could avoid this by performing the action prior to adding other fields, but I really like to use this action as a last step.

I've looked at the Acrobat DC SDK Documentation and found the method setPageTabOrder, but that seems to apply changes to the entire page. I'm really just looking for a way to stick the added fields at the top of the order, rather than the bottom. Is this possible?

Thank you!

TOPICS
Acrobat SDK and JavaScript
2.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 19, 2018 Jan 19, 2018

Not possible with JS.

Translate
Community Expert ,
Jan 19, 2018 Jan 19, 2018

Not possible with JS.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2018 Jan 19, 2018

You can't actually set the tab order but you can script the equivalent. You can add a script to the "onBlur" event of a field that  calls the Field.setFocus() method for the next field you want the user to go to.

What I've been asked to do this for my customers, I start with an array of field names and then write a script that injects the appropriate script into each field automatically.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 19, 2018 Jan 19, 2018

Thank you! I hadn't thought of doing that!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 10, 2022 Nov 10, 2022

This method works, but there is a small problem. When pressing the TAB key, i.e. 'go to next' everything is fine, but pressing Shift + TAB i.e. 'go to previous' is already a problem. By adding many fields using scripts, we disturb the order, and if your way we go to the field that was before the scripts, then pressing Shift + TAB will cause a jump to the previous field, but the previous one from the document version BEFORE the scripts were run, which will be 99% different than we want.
This could be solved by recognizing what key triggered the OnBlur action, or maybe pressing TAB or Shift + TAB. If you solved this problem, I would be grateful for the hint because I don't know how to do it ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 21, 2022 Nov 21, 2022
LATEST

As mentioned by @try67 this is not possible in JS.

For anyone looking for a solution to get the tab order by row, you can use "Accessibility > Set Tab Order Property" in the "Action Wizard" and then "Use Row" in the "Specify Settings":

  1.  Open Tools > Action Wizard
  2.  Create a new Action
  3.  Use "Set Tab Order Priority" as mentioned above

acrobat pro tab order.pngexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines