Copy link to clipboard
Copied
I am very new at creating custom calculation scripts, and I don't know how to do the following:
I need to calulate the total of all fees associated with the boxes checked:
The checkboxes are titled Checkbox1, Checkbox2, etc.
The exception is the custom fee boxes, that's where I'm getting stuck. If those checkboxes are clicked, they will enter a dollar amount in the FEE1-FEE3 fields.
The Total will be calculated in a "Total Fees" field.
Is this possible?
Thank you VERY much for your help!
You can do it using this code (I assumed the names of the check-boxes are Checkbox1 to Checkbox10):
var total = 0;
for (var i=1; i<=7; i++) {
var v = this.getField("Checkbox"+i).valueAsString;
if (v!="Off") total+=Number(v);
}
if (this.getField("Checkbox8").valueAsString!="Off") total+=Number(this.getField("FEE1").valueAsString);
if (this.getField("Checkbox9").valueAsString!="Off") total+=Number(this.getField("FEE2").valueAsString);
if (this.getField("Checkbox10").valueAsString!="Off") total
...
Copy link to clipboard
Copied
in the future, to find the best place to post your message, use the list here, https://community.adobe.com/
<moved from using the community>
Copy link to clipboard
Copied
You can do it using this code (I assumed the names of the check-boxes are Checkbox1 to Checkbox10):
var total = 0;
for (var i=1; i<=7; i++) {
var v = this.getField("Checkbox"+i).valueAsString;
if (v!="Off") total+=Number(v);
}
if (this.getField("Checkbox8").valueAsString!="Off") total+=Number(this.getField("FEE1").valueAsString);
if (this.getField("Checkbox9").valueAsString!="Off") total+=Number(this.getField("FEE2").valueAsString);
if (this.getField("Checkbox10").valueAsString!="Off") total+=Number(this.getField("FEE3").valueAsString);
event.value = total;
In order for it to work, though, you must set the export values of the first 7 check-boxes as the price for that item (without the dollar symbol, just as a number).
Copy link to clipboard
Copied
Thank you VERY much Try67 - that worked perfectly! I've seen your other replies - you are such a blessing to this community, I appreciate you!