Highlighted

Applying different taxes to a Subtotal in Acrobat form

New Here ,
May 29, 2020

Copy link to clipboard

Copied

Screenshot.png

 

 

 

 

 

 

I'm trying to create a script for:

If the checkbox (New Orleans) is selected, then 9.2% sales tax would be applied to Subtotal.

or when the checkbox (Baton Rouge) is selected, then 9.95% sales tax would be applied to Subtotal.

 

So the TOTAL box would show (Subtotal*SalesTax)-GiftCard=TOTAL

Topics

PDF forms

Views

208

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

Applying different taxes to a Subtotal in Acrobat form

New Here ,
May 29, 2020

Copy link to clipboard

Copied

Screenshot.png

 

 

 

 

 

 

I'm trying to create a script for:

If the checkbox (New Orleans) is selected, then 9.2% sales tax would be applied to Subtotal.

or when the checkbox (Baton Rouge) is selected, then 9.95% sales tax would be applied to Subtotal.

 

So the TOTAL box would show (Subtotal*SalesTax)-GiftCard=TOTAL

Topics

PDF forms

Views

209

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
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

You'll need to use a calculation script. See this tutorial, there's a sample file:

https://acrobatusers.com/tutorials/conditional-execution/

 

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...
New Here ,
May 29, 2020

Copy link to clipboard

Copied

Thank you Thom_Paker.

I'm having trouble with what field name goes where? And the script goes in the Custom Calculation Script box, correct. I'm sorry, I really don't have any javascript training. I just know it can be done. 🙂 

Can you make the script for me, to where I can understand and use. Thank you in advance. 

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...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

First, give both the checkboxes the same name, make it "PickUp", then change the export value of each to "New Orleans" and "Baton Rouge"

 

Put the calculation in the "SalesTax" field.

 

switch(this.getField("PickUp").value)

{

    case "New Orleans":

       event.value = this.getField("SubTotal").value*.092;

       break;

    case "Baton Rouge":

       event.value = this.getField("SubTotal").value*.0995;

       break;

}

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...
New Here ,
May 29, 2020

Copy link to clipboard

Copied

I'm sorry, I couldn't get it to work. Here's what I did: For the 2 Checkboxes, under General, named PickUp. Then under Options for the Export Value, I entered New Orleans for first CB and Baton Rouge for second CB. Do I need to change anything under the Actions tab?

Screenshot3.png

THEN I selected the SalesTax field and pasted your script under the Custom Calculation Script. Hit OK and close. Now Preview to test it.....

Screenshot4.png

Nothing comes through. I see my Total field isn't working. 

Screenshot5.png

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...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

Check the console window for errors.  You'll see that one of the getField ops is returning null because "SubTotal" is spelled wrong.

Scripts have be written exactly right. Field Names must match exactly. 

 

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...
New Here ,
May 29, 2020

Copy link to clipboard

Copied

Yep that was it. needed a lowercase t.  Now what calculation script do I need for the TOTAL field?

 

Amazing how that wrong case threw all off. I really do appreciate your expertise help.

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...
Adobe Community Professional ,
May 29, 2020

Copy link to clipboard

Copied

If it's just a straight addition, then you don't need a script, use the built-in SUM 

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...
ginamacs LATEST
New Here ,
May 29, 2020

Copy link to clipboard

Copied

Thanks

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...