These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Formulas for PDF fields

runningeagle
Registered: Sep 12 2007
Posts: 5

I am new to PDF form creation, but I have created a simple order form for a wine customer which does the math calculations.
 
My problem is that the "tax" field is only to be filled out by California residents.
 
I'd like to do 2 things that I am unable to achieve with my present knowledge.
 
1. Have a "radio" button activate the calculation for the tax field ONLY when checked.
 
2. Create the formula which would multiply the "sub-total" field by 8.5% and place it in the "tax" field.
 
Thanks for any help you can give.

My Product Information:
Acrobat Pro 7.0.9, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Let's say that your radio buttons are named "SelTax". Then you could place this JavaScript code into the calculation event for the "tax" field.

if(this.getField("SelTax").isBoxChecked(0))event.value = this.getField("subtotal").value * 0.085;elseevent.value = 0;

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

runningeagle
Registered: Sep 12 2007
Posts: 5
Will you marry me!....just kidding....but thanks it worked perfectly!

I guess you need to know some alien language to do that simple thing....I would never have gotten there.

Thanks Again
Runningeagle
runningeagle
Registered: Sep 12 2007
Posts: 5
Hi Thom,

Posted my "thank-you" in the question field....but I'm sure you get it.

Again Thanks
Runningeagle
Jazmine
Registered: Jul 9 2010
Posts: 9
I need your help... I just need to know what code to put so that it calculates tax. I have 3 fields that i need to add (subtotal+Install+ Delivery) then need to add the tax which is 8.250%. can you please help me?

C. Escalante

try67
Online
Expert
Registered: Oct 30 2008
Posts: 2399
In the Simple Notation Field, enter this:
(subtotal+Install+ Delivery) * 1.0825

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Sales tax is not always computed on installation and delivery charges. And there could be a requirement to state the sales tax separately. I would add 2 fields, one for the sales tax rate and the other for the computed sales tax. Using a field name of "SalesTaxRate" with a format of 'Percent', 4 decimal places, a default value of 0.0825, and set as read only. The field for the amount of tax could be "SalesTaxAmount" with a number format and 2 decimal places, set as read only with a simplified field notation of 'SalesTaxRate * subtotal'. The grand total field could then have the 'simplified field notation' of 'subtotal + SalesTaxAmount + install + Delivery'.

Having the sales tax rate in a field allows for easier maintenance, and showing the amount of sales tax charged can meet legal requirements for disclosure and accumulation of sales tax charged that needs to be paid to the taxing agency and may have implications for income tax of the customer.

All of the above assumes the vendor needs to collect sales tax on every sale.

George Kaiser