Hello,
Background Info:
This is an order form for a text ad listing. There is a commercial rate and non-profit rate. The user can select how many months they wish for their ad to run for. Using product field and quantity field works perfectly to update the total. My issue is in a second option to allow the user to 'upgrade' their listing with an image (checkbox field) should add $25/month to the total.
Here is my setup:
Product:
Commercial - $50
Non-Profit - $35
Options:
1 Month|1
2 Months|2
...
12 Months|12
Upgrade?:
Checkbox (default is unchecked)
My function to update the total:
function gform_product_total(formId, total){
if (jQuery("#choice_22_1").is(":checked")) { //Checks to see if 'upgrade' checkbox is checked or not
var monthRun = (jQuery("#input_12_20").val()); //Product options drop down with options for 1-12 months with values of 1-12
var logoCost = (25 * monthRun); //Computes additional cost if checkbox to use logo/image is checked
return total + logoCost; //Computes total of additional cost and base cost of product
} else {
return total;
}
}
This function updates the total properly but it won't auto-update the field. I have to go back and click on the radio button for the product type, e.g., commercial before it updates the total.
How can I force the total to update when the user checks the upgrade box?
Also if you have any recommendations to make my function cleaner I'm all ears.
Thanks