Skip to main content
CFparks15144037
New Participant
March 6, 2020
Question

Fillable PDF Custom Calculation Order Form

  • March 6, 2020
  • 1 reply
  • 518 views

I've been looking for over an hour, so I apologize if someone has already asked this and I just can't find it!

I have an order form with 5 lines of "quantity" and "unit price"; I need the "total" box to show the total of all 5 lines of their quantity times price. I know I could add another column of a subtotal for each line and then just add those subtotals up, but I think that's just cluttering up the form.

This topic has been closed for replies.

1 reply

try67
Braniac
March 6, 2020

As the custom Calculation script of the Total field enter the following script:

 

var total = 0;
for (var i=1; i<=5; i++) {
	total+=Number(this.getField("Quantity "+i).valueAsString) * Number(this.getField("Price "+i).valueAsString);
}
event.value = total;

 

CFparks15144037
New Participant
March 6, 2020

YOU'RE. THE. BEST. Thank you so much, it worked perfectly!