Is it possible to limit the number of decimal places in a field that has been calculated?
I have selected 'Decimal Places: 2' in the Text Field Properties section, but when you click into the box a string of numbers appear. The calculation is correct, but the extra numbers are not required because it is a form for simple financial records.
Thanks in advance
C
You can use the "util.printf(cFormat, arguments)" method.
The "cFormat" string consist of the following options:
%[,nDecSep][cFlags][nWidth][.nPrecision]cConvChar
The example script:
var n = Math.PI * 100; // a convenient value
console.println("PI * 100 = " + n); // show full number
var dRounded = util.printf("%.2f", n); // round to 1/100's
console.println("Rounded float format:" + dRounded); // display result
More information is contained in the Acrobat JS API Reference.
George Kaiser