## Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.

• How to custom calculate for a form field based on ...

# How to custom calculate for a form field based on the total in another field. Tiered calculations

Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copied

Hi There! Super new to all of this so bare with me. There are 2 form fields that I am trying get to automatically calculate the tiered discount and tiered shipping... according to what the Subtotal is.

The TOTALDiscount Field and the TOTALSHIPPING field.

TOTALDiscount- I need to automatically calculate the discount received according to the SUBTOTAL and the following tier:
5% discount off of Subtotal for Subtotal that is \$3500-\$6999

10% discount off of Subtotal for Subtotal that is \$7000 or more.

TOTALSHIPPING - I need to automatically calculate the shipping cost according to the SUBTOTAL and the following tier:

15% calculation of Subtotal if Subtotal is \$1-\$500

10% calculation of Subtotal if Subtotal is \$501-\$1000

7% calculation of Subtotal if Subtotal is \$1001-\$5000

4% calculation of Subtotal if Subtotal is \$5001 or more

I hope this makes sense! Thank you for your help!

TOPICS
JavaScript

Views

36

Likes

Report

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

Adobe Community Professional , Jul 12, 2021 Jul 12, 2021
Put script as "Custom calculation script" in: TOTALDiscount: var sub = this.getField("SUBTOTAL").value; if(sub >= 3500 && sub <= 6999) event.value = sub*.05; else if(sub >= 7000) event.value = sub*.10; else event.value = ""; TOTALSHIPPING: var sub = this.getField("SUBTOTAL").value; if(sub >=1 && sub <=500) event.value = sub*.15; else if(sub >=501 && sub <=1000) event.value = sub*.10; else if(sub >=1001 && sub <=5000) event.value = sub*.07; else if(sub >=5001) event.value = sub*.04; else event....

Likes

4 Replies 4
Community Beginner ,
Jul 12, 2021 Jul 12, 2021

Copied

OH! I am using Adobe Acrobat Pro DC

Likes

Report

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

Copied

Use Javascript at Custom Calculation Script.

Likes

Report

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

Copied

Put script as "Custom calculation script" in:

TOTALDiscount:

var sub = this.getField("SUBTOTAL").value;
if(sub >= 3500 && sub <= 6999) event.value = sub*.05;
else if(sub >= 7000) event.value = sub*.10;
else event.value = "";

TOTALSHIPPING:

var sub = this.getField("SUBTOTAL").value;
if(sub >=1 && sub <=500) event.value = sub*.15;
else if(sub >=501 && sub <=1000) event.value = sub*.10;
else if(sub >=1001 && sub <=5000) event.value = sub*.07;
else if(sub >=5001) event.value = sub*.04;
else event.value = "";

Likes

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 Beginner ,
Jul 12, 2021 Jul 12, 2021

Copied

LATEST

THANK YOU SOOOOO MUCH!! It works perfectly!!

Thank you!

Likes

Report

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