Copy link to clipboard
Copied
I have a receipt form with many number fields. I need a field "Card Fee" to contain the product of 0.05 by the sum of four other fields when the "Charge" checkbox is ticked. Many times only one of these summed fields ("Parts") will contain a value, which is the sum of several other fields, if that matters.
The breakdown of the equation is:
("Core Due" + "Parts" + "Service" + "Shipping") * 0.05 = "Card Fee"
Copy link to clipboard
Copied
Use this as custom calculation script of "Card Fee" field:
var f1 = Number(this.getField("Core Due").valueAsString);
var f2 = Number(this.getField("Parts").valueAsString);
var f3 = Number(this.getField("Service").valueAsString);
var f4 = Number(this.getField("Shipping").valueAsString);
var check = this.getField("Charge").valueAsString;
var total = (f1+f2+f3+f4)*0.05;
event.value = (check === "Off") ? "" : total;
Copy link to clipboard
Copied
Use this as custom calculation script of "Card Fee" field:
var f1 = Number(this.getField("Core Due").valueAsString);
var f2 = Number(this.getField("Parts").valueAsString);
var f3 = Number(this.getField("Service").valueAsString);
var f4 = Number(this.getField("Shipping").valueAsString);
var check = this.getField("Charge").valueAsString;
var total = (f1+f2+f3+f4)*0.05;
event.value = (check === "Off") ? "" : total;
Copy link to clipboard
Copied
I copied and pasted and realized my Shipping field is actually named "Total Shipping." I added that to the script, but it still didn't work 😞
Copy link to clipboard
Copied
Thank you! I was entering as a custom validation script lol, once I realized my error, your script worked perfect.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more