Copy link to clipboard
Copied
Hi,
I need my total value amount in my form to display two decimal places. At the moment it shows as .00 no matter what numbers I put in.
The script I am using is this:
(function () {
// Get the field values, as numbers
var v1 = +getField("ccc").value;
var v2 = +getField("ddd").value;
if (v1 !== 0) {
event.value = v1 * v2 * 220;
} else {
event.value = "";
}
})();
Please help! Thanks in advance.
Copy link to clipboard
Copied
Change that one line to:
event.value = util.printf("%.2f", v1 * v2 * 220);
If that doesn't work, please give examples of the values for the ccc and ddd fields, along with the displayed result.
Copy link to clipboard
Copied
Hi, thanks for your reply but that didn't work.
ccc is calculated by:
(function () {
// Get the field values, as numbers
var v1 = +getField("aaa").value;
var v2 = +getField("bbb").value;
if (v2 !== 0) {
event.value = v1 / v2 ;
} else {
event.value = "";
}
})();
So i have aaa, bbb, ccc, ddd, eee. On my phone in Reader when these equal 65, 1.35, 48, and 25 respectively I get eee to equal 264,814.8
On my desktop when these same values are entered eee displays as 264,000.00
Copy link to clipboard
Copied
What do you have set as a format on the calculated fields? I'd suggest removing all formatting. Then let us know what you got.
Sounds like Reader is having an issue. Could be extra code that's in there.
Copy link to clipboard
Copied
Hi
I had the formatting set to:
Number
Decimal Places: 2
Separator Style: 1,234.56
Currency Symbol: None
and that's it.
I've just reset them all to "none" and it's still not working.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now