How do I specify a number format with 2 decimal places for a field that already is using a custom format script?
I have a form that has many sub-total and total fields. I want those fields to:
(1) have PHP unit
(2) have comma separator
(3) display as empty if the value is zero
So I have entered the following custom format script for the field:
var x = event.value;
var n = x.toString().split(".");
n[0] = n[0].replace(/B(?=(d{3})+(?!d))/g, ",");
if(event.value == 0) event.value = "";
else event.value = "Php "+ n.join(".");
All conditions are met but I want the result to be in 2 decimal places only, there are times that 2 decimal places is the result but most of the time it shows 3 or more decimal places.