Format Multiple Fields Simultaneously
When not allowed by the Acrobat user interface
Text and dropdown fields have a format tab so the format of the field can be set.
In field editing mode, the properties of multiple fields can be set at the same time by simply selecting those fields and changing the properties of one of the selected fields in the properties window. This does not work for all properties because certain property tabs are missing when multiple fields are selected, as I described in Widgets. Format is one of those missing tabs.
Get the course above, and a suite of automation tools for FREE with a Professional subscription.
Formatting Fields Using JavaScript
In Using JavaScript To Add JavaScript to a PDF Part 2, I described how to format a field using a script, and how to find those custom Format and Keystroke scripts. You have to name a field to format it with a script, so how do you format multiple fields simultaneously with a script? As I've stated several times, field naming requires some thought if you want to save time when programming PDF fillable forms.
If you use the right-click > Create multiple copies feature in form editing mode, the fields will automatically be named with a number suffix (.0, .1, .2, .3, etc.). This can be used to loop through all of the fields by adding an incrementing number to the field names:
for(var i=0;i<10;i++)
{
this.getField("Text."+i).setAction('Format','/*format script*/');
this.getField("Text."+i).setAction('Keystroke','/*keystroke script*/');
}Keep reading with a 7-day free trial
Subscribe to PDF Automation Station to keep reading this post and get 7 days of free access to the full post archives.




