These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Need to format multiple fields simulateously

juliel
Registered: Dec 30 2009
Posts: 15

In Adobe Acrobat Pro 9 Is it possible to change multiple text field's format at once? When I right-click on a single text field and select properties it will let me change the format from None to Number. But when I select multiple text fields at once (ctrl+click) and select properties the format tab is not an option, and I have a PDF with over 100 text fields in it and I need to quickly adjust them all to the following format:

Category: Number
Decimal Places: 2
Currency Symbol: Dollar ($)

Please let me know.

Thanks!

My Product Information:
Acrobat Pro 9.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Sadly, no. Not even with a script.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Not real easy, but with the 'setAction()' method and using the 'AFNumber_Format()' funciton one can use JavaScript to set the filed numberic format. This is sort of documented in Acrobat 5 JS Reference.


Acrobat's provided forms function call:

Quote:
AFNumber_Format(nDnumericecprovided, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)nDec = number of decimals
sepStyle = separator style 0 = 1,234.56 / 1 = 1234.56 / 2 = 1.234,56 / 3 = 1234,56 /
negStyle = 0 black minus / 1 red minus / 2 parens black / 3 parens red /
currStyle = reserved
strCurrency = string of currency to display
bCurrencyPrepend = true = pre pend / false = post pend

George Kaiser

juliel
Registered: Dec 30 2009
Posts: 15
I don't really understand your answer. What is the " 'setAction()' method and the 'AFNumber_Format()' function"? Also, what are function calls? How do I use the method, function and function calls with Java Script? Is there an actual code that I can put in the properties dialogue box under "Format - Run Java Script"?

Thanks for your help!
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
'AFNumber_Format' is a folder level function supplied by Adobe as part of Acrobat or Reader. It is used by Acrobat to set the form field numeric format.

The 'setAction' method of the field object allows one to change a specific action of a field using JavaScript.

The 'AFNUmber_Format' is shown in the Acrobat 5 JS API Reference.

The 'setAction' method has been part of Acrobat JavaScript since the introduction of JavaScript to Acrobat.
// define array of field names to processvar aFieldNames = new Array('Text1', 'Text2', 'Text3'); // specify the numeric field optionsvar  nDec = 2; // number of decimal placesvar sepStyle = 0; // 1,234.56 negStyle = 0 ; // black minus currStyle = ''; // reservedstrCurrency = '$'; // USD signbCurrencyPrepend = true; // place before number // process the field namesfor (i = 0; i < aFieldNames.length; i++) {// get the field object for name ivar fn = this.getField(aFieldNames[i]);fn.setAction({cTrigger: 'Format', cScript: 'AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend)'});} // end loop for field names processing

George Kaiser