Creating a Custom Calculation Script in Adobe Acrobat
Hi! I don't have any experience with script, but I think that I need to create a custom calculation script in my Adobe Acrobat form.
I have created a budget form and simply want to be able to enter expenses and have them automatically add up the running total. I'm trying to figure out a way to code this in the calculation area easily, without needing to write new code for each box.
So, for example, the form looks like this:
Date Description Category Amount Balance
4/23 Chipotle Food $25 $25
4/25 Starbucks Food $10 $35
4/27 Target Supplies $100 $135
I want the form to be able to automatically calculate that the balance is 35 when I add in the 10 for Starbucks, then 135 when I enter 100 for Target, etc. From looking it up in the past, I used the following for some similar calculations:
// Obtain the value from the first field
var v1 = getField("balance1").value;
// Obtain the value from the second field
var v2 = getField("amount2").value;
// Set this field value equal to the sum
event.value = v1 + v2;
When balance1 is the $25 and amount2 is the $10.
Is there a way I can change this formula to be able to use it for every balance field without needing to edit the formula in each one separately?
Thank you for your assistance!!
kristy

