Skip to main content
Inspiring
October 30, 2025
Question

Are there any javascripts that can find number formatted text fields

  • October 30, 2025
  • 1 reply
  • 67 views

Hi all,

 

I am looking for a javascript that will update any text fields on a form that have been formatted to 'number' and change the decimal places from 2 to 0. 

1 reply

PDF Automation Station
Community Expert
Community Expert
October 30, 2025

There is no way to determine which fields are formatted with a number using a script.  However, you can use a setAction script to reformat these fields.  The number format contains a format script as well as a keystroke script that you can't see in the field properties.  If your formatted fields have a specific hierarchical naming scheme, you can loop through them all and apply the setAction method with a script.  If not, you can name them all in an array and loop through the array, applying the setAction scripts to each field.

Another method is to select the fields, add the setAction script in a mouse enter field for all selected fields at once, then run the cursor over the fields, so the scripts trigger.  Then reselect them all in prepare form mode and remove the action.

https://community.adobe.com/t5/acrobat-discussions/how-do-i-change-the-tooltip-for-multiple-fields-at-the-same-time/m-p/15565163#M523455

Yet another way is to select them all and then change a property for all fields at once that is not a usual setting for fields.  You can then loop through all the fields, test for the property, apply the setAction method, then return the property back to the original.  The property I use for this is the Orientation in the general tab.  That's because it is usually 0 and you can change multiple fields at once.  Change it to 270, test for 270, apply setAction, then return it to the original setting (0).  This article explains how to find the Format and Keystroke scripts to apply with setAction and how to apply them:

https://pdfautomationstation.substack.com/p/using-javascript-to-add-javascript-232