I've wrestled with this problem for the last 3 hours. I know how to do basic form calculations in a PDF form but I've come to the conclusion that I know far too little about using javascript to calculate within a PDF form and am hoping some of you kind folks might help me out.
Here's the situation:
I have a field (balancedue) that is based on the values in 2 other fields (totalfees and totalrebate).
If totalfees is greater than total rebate I want it to subtract the totalrebate from the totalfees and put the value in the balancedue field.
If totalfees is less than the totalrebate I want it to put a zero in the balancedue field.
I created the following if statement as a custom calculation script in the balancedue field:
++++++++++++++++++++++++++++++++++++++++++++++
var tf = +getField("totalfees").value;
var tr = +getField("totalrebate").value;
if (tf < tr) {
event.value = 0;
}
else
{
event.value = tf - tr;
}
+++++++++++++++++++++++++++++++++++++++++++++++
The first time through, it calculates just fine after I enter the totalfees value and the totalrebate value. Then if I change the totalfees value OR the totalrebate value (as if I entered one of them incorrectly the first time) the balancedue doesn't recalculate. The only way it will recalculate is if I reenter the values in BOTH the totalfees and the totalrebate fields.
Can someone clue me in on why it won't recalculate unless both totalfees and totalrebate are both changed and how I might fix it?
Thanks in advance for any help. I appreciate it.
Thanks to acrobat expert gkaiseril's answer in another forum I figured it out. All I had to do was fix the calcuation order and it worked.