• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Fillable PDF Custom Calculation Order Form

New Here ,
Mar 06, 2020 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

Views

65

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
community guidelines
Community Expert ,
Mar 06, 2020 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
community guidelines
New Here ,
Mar 06, 2020 Mar 06, 2020

Copy link to clipboard

Copied

LATEST

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
community guidelines