Copy link to clipboard
Copied
I have a fillable form with auto calculations for costs. The blank calculation fields show up as 0.00 in the field. I need the blanks to be empty showing no zeros. When they do enter a number to calculate, I need the results to show 2 decimals, such as $ 19.50. I prefer to do this using a custom format field. Right now I have the follwing in my custom format scrip:
if((event.value == 0) || isNaN(event.value) || (event.value == Infinity))
event.value = "";
This shows 19.50 as 19.5 and shows 55.00 as 55. How can I get this to display correctly?
Copy link to clipboard
Copied
Add this to the end of your code:
else event.value = event.value.toFixed(2);
Copy link to clipboard
Copied
Or
if (event.value <= 0) event.value = "";
else event.value = util.printf("%0.2f",event.value);