mercredi 27 mai 2015

Acrobat PDF calculation with checkbox

I've created a PDF form to help create an estimate for plumbing work. There are various lines that the contractor fills in for quanity, cost of the item and then automatically calculates the price for that line; this works fine.

But now I want to add a checkbox to the line that the customer would check if they actually want that work to be done. If they check the box then the price would appear in the final field, otherwise it would display 0.

My fields are: QtyRow2 ItemCostRow2 CheckboxRow2 PriceRow2

I've tried this Javascript code in the Calculation tab for the PriceRow2 field, but it displays "0" in the price field whether the checkbox is checked or not.

var oFldQty = this.getField("QtyRow2");
var oFldItem = this.getField("ItemCostRow2");

if (this.getField("CheckboxRow2").isBoxChecked(0)) {
    nSubTotal = oFldQty.value * oFldItem.value;
} else {
    nSubTotal = 0;
}

event.value = nSubTotal;

How should I modify this to get it to work?




Aucun commentaire:

Enregistrer un commentaire