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

trying to calculate a total price based upon a condition

klwalsh611
Registered: Sep 10 2009
Posts: 28

I have an order form with products, sizes and pricing for each size range. I need to know how to calculate the total cost for a particular product based upon the size selected by the customer.

field names are as follows "17164_SZ" (a list box with a range of sizes from 32-52), "17164_PRICE" (hidden text box with a price for sizes 32-44), "17164_XL_PRICE" (hidden text box with a price for sizes 46-52), "17164_QTY" (text box that the customer fills in ) and "17164_EXT" (text box, action to be set to custom script)

I need a script that will calculate the 17164_EXT as a product of either 17164_PRICE * 17164_QTY or 17164_XL_PRICE * 17164_QTY based upon the value entered into 17164_SZ.

I'm new to javascripting so I don't know what the actual code should be. I understand the logic.

My Product Information:
Acrobat Pro 9.2, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Did you try using the built-in simple notation script?

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

klwalsh611
Registered: Sep 10 2009
Posts: 28
I don't know what the appropriate scripting would be for that which is why I'm posting a question here. I have referenced some of the javascript sites that address field validation and such but it's over my head. I am literally a newbie to this world -- I have been creating pdf forms in Acrobat Pro 9 since September but most of them have been simple -- the quantity * the price of an item is the final autocalculated value for the 'total price' field.

my most recent order form has one price for a size range and a second upcharge price for a larger size range. how do I script the field so that it looks at the size field to determine which price field to use in the calculation? That is my question. Thanks.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Here's an article on doing calculations:
http://www.acrobatusers.com/tutorials/2006/form_calculations

if you go to the tutorials on this web site and search for "calc" you'll find a few other articles

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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