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

util.printf

NewbieToAcrobatJava
Registered: Oct 10 2009
Posts: 2
Answered

i am new to this game and climbing the wall.

i using AcrobatPro9 in windows.

i want to create a text field that:
has format category: number
decimal places: zero
if another text field (same format) is zero then print zero no decimal places
else a calculation with result to 4 decimal places

i have tried to use "util.printf " it is not working:
var n = 8.1234567;
event.value = util.printf("% .4f",n);

i get an error message:
"the value entered does not match format of field"

if i set the format - decimal places to 5 and try:
var n = 6.123456789;
event.value = util.printf("%.2f",n);

i get:
6.12000

why i am not able to change the decimal place format?

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Because the automated validation requires a character string to comply with the display format.

If you want to modify the format parameters you will need to use the 'setAction' method to set the format and the undocumented 'AFNumber_Format' function to specify the numeric format options.

[url=http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=482]Setting number format to a text field[/url]

George Kaiser