How to use radio buttons to choose which calculations run
I am attempting to create a form for our seedling tree order form, and am running into a little trouble with calculating the proper total, as our taxation rates vary depending upon the method of shipment being used. I believe my end result can be created with a little help from a custom calculation script, but I have no experience with java script, and am hopeful that someone can give me an assist here.
Already set up, I have:
Two radio buttons used to indicate the method of distribution desired
-Local Pick Up
-UPS Shipping
I have two hidden fields, in which calculations are run to figure the two tax values, one of which should be applied. (LocTax) and (UPSTax)
I have fields to calculate the total cost for shipping (Ship Tot), for the sub total of items ordered (Item Tot), a placeholder for the tax rate (Tax Tot), and a Final Order Total (Order Tot) field, in which the sub total, shipping costs, and tax rate are added, and the final total displayed.
My problem is with this last section, as in order to properly calculate and display the total cost for an order, the proper tax value needs to be used.
I’d like for the value of the placeholder (Tax Tot) to be filled based upon the radio button selected.
So,
If Local Pick Up is selected, then the Tax Tot field should be populated with the value from the hidden LocTax field.
If UPS Shipping is selected, then the Tax Tot should populate with the value from the hidden UPSTax field.
I’m reasonably certain that a script could be written to do this, possibly even in such a way as to negate the need for my hidden fields, but I have no experience with javascript and am not sure how to write this.
I’d appreciate any assistance anyone could offer in how to do this, especially as I may need to further complicate it by adding one more variable, a tax exempt button, which would negate either of the above choices if selected.
Many thanks!!
