Fillable PDF Custom Calculation Order Form

New Here ,
Mar 06, 2020

Copy link to clipboard

Copied

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.

PR.jpg

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

42

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Fillable PDF Custom Calculation Order Form

New Here ,
Mar 06, 2020

Copy link to clipboard

Copied

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.

PR.jpg

TOPICS
Acrobat SDK and JavaScript, How to, PDF forms

Views

43

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 06, 2020 0
Most Valuable Participant ,
Mar 06, 2020

Copy link to clipboard

Copied

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;

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 06, 2020 0
CFparks LATEST
New Here ,
Mar 06, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 06, 2020 0