Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Calculated Field with currency formatting and hiding zero values

$
0
0

I am designing a PDF form for sales quotes and I have a field set to multiply the quantity of an item and the per unit price to give the extended price.  There are 5 lines on each quote and if the users are only quoting 1 or 2 items I want the zero values in the unused extended price fields to be hidden.

 

I did that with the following script

 

if (event.value == 0) event.value = '';

 

But when I enter something in the quantity and price the extended price is displayed as a plain number (100) instead of currency ($100).

 

I can format it to change to currency with

 

event.value = util.printf ("$%.2f", event.value);

 

I am sure there is a way to combine them to result in an if then situation, so if the field is 0, make null and if not then format as currency but I am not sure how to do it.

 

Any help would be appreciated.

 

Andrew


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>