Copy link to clipboard
Copied
Hello,
I'm working on a PDF form in Adobe Acrobat Pro DC, and I need to extract the names of all form fields in their tab order. Is there a way to do this using JavaScript or any built-in functionality?
So far, I’ve tried checking the field names manually from the Fields panel, but it’s tedious for large forms. I’ve also looked through the JavaScript documentation but haven’t found a clear solution.
Could someone guide me on how to automate this process or point me to the right resources?
Thank you!
No, not possible in Acrobat. You can only infer it if you know that the tab order is based on rows or columns, but if it's unspecified (ie. custom set) then a script has no way of knowing what it is.
You can semi-automate the list extraction. Here's how:
1) Run a script in the console that sets an On Focus action for every field, that prints the field name to the console.
for(var i = 0; i < this.numFields; i++)
{
var fieldName = this.getNthFieldName(i);
var fld=this.getField(fieldName);
fld.setAction('OnFocus','console.println(event.target.name)');
}
2) Clear the console.
3) Click the first field in the tabbing order and hold down the tab key until you get the last field.
4) Open the cons
...Copy link to clipboard
Copied
No, not possible in Acrobat. You can only infer it if you know that the tab order is based on rows or columns, but if it's unspecified (ie. custom set) then a script has no way of knowing what it is.
Copy link to clipboard
Copied
Thank you @try67
Copy link to clipboard
Copied
You can semi-automate the list extraction. Here's how:
1) Run a script in the console that sets an On Focus action for every field, that prints the field name to the console.
for(var i = 0; i < this.numFields; i++)
{
var fieldName = this.getNthFieldName(i);
var fld=this.getField(fieldName);
fld.setAction('OnFocus','console.println(event.target.name)');
}
2) Clear the console.
3) Click the first field in the tabbing order and hold down the tab key until you get the last field.
4) Open the console and copy the list.
5) Close the document without saving so field actions won't be saved.
This will skip hidden fields. If you need them in the list you can always unhide all fields first. It also won't show the widget number of duplicate fields.
Copy link to clipboard
Copied
I would also suggest adding an alert to the script in the last field in the tabbing order: app.alert("List is finished"). This way you can hold down the tab key and zip through all the fields quickly. When the alert pops up the tabbing won't start again so you can let go of the tab key. You will have to dismissed the alert before anything else happens.
Copy link to clipboard
Copied
Nice workaround!
Copy link to clipboard
Copied
Thanks.
Copy link to clipboard
Copied
Thank you @PDF Automation Station