These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

if statement

fossey
Registered: Feb 27 2009
Posts: 13
Answered

I have created a form where a quantity field is multiplied by a unit price for a total cost.
This is the code I am using:

var a = this.getField("QTY1");
var b = this.getField("UNIT PRICE1");

event.value = a.value*b.value

If the quantity column is not used, the total cost is showing up as $0.00.
How do I get the total cost column to be blank if the quantity or unit price fields are empty?

Thanks for you help.

suewhitehead
Registered: Jun 3 2008
Posts: 232
In order to make the form show only a blank box, for calculations that were entered using the SUM OF or PRODUCT OF check boxes, and also for Simplified Field Notation calculations, you will need to put the following script in the VALIDATION tab under RUN CUSTOM VALIDATION SCRIPT. For Custom Javascript calculations, follow the calculation by a semicolon (;) and then add this script on the next line.

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