...

View Full Version : Using some Javascript in an Adobe PDF Form



KnottyMars
09-14-2011, 01:02 AM
Hiya,

Ive been getting a form together that tallies billable parts for a service call. Each line has a quantity and a price and a subtotal. I have a grand total at the bottom that sums the subtotals.

Everything is working fine, but I have a combo box that chooses whether the subtotal should zero out the field. So I would select Yes/No in the dropdown and it should change the subtotal to zero. That part is not working. Im using the following code which works without the Yes/No dropdown.



var L1 = "Cost.0"; var L2 = "Quantity.0";
var sum = 0;
sum = this.getField(L1).value * this.getField(L2).value;
f = this.getField("SubPrice0");
f.value = sum;


This is what I am trying and cant get to work



var L1 = "Cost.0"; var L2 = "Quantity.0";
var sum = 0;
sum = this.getField(L1).value * this.getField(L2).value;

if (this.getField("Bill0") = "Yes")
{
f = this.getField("SubPrice0");
f.value = sum;
}
else
{
f = this.getField("SubPrice0");
f.value = 0;
}


Output in the combo box is Yes/No respectively. Any help would be appreciated. Sorry, its probably an easy thing that Im missing. :o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum