Calculation totals from user selections of dropdowns and radio buttons

Need to display a variety of service-price-calculation TOTALS based on users selections of dropdown fields and radio buttons. How to configure Gravity Forms to do these calculations? See below showing example of a few of the combinations. There are 15 different combinations.

EXAMPLES of 15 combinations:

Field “single-family” and field “every-week” = $20.00+[and field “kitchen” +35 and field “living-areas” +20 and field “basement” +15 and field “one-bedroom” +5 and field “one-bathroom +10] = Total $105

Field “single-family” and field “every-month” = $45.00 [and field “kitchen” +35 and field “living-areas” +15 and field “basement” +15 and field “one-bedroom” +5 and field “one-bathroom +10]= Total $125

Field “townhouse” and field “deep-clean” = $65.00+[and field “kitchen” +40 and field “living-areas” +30 and field “basement” +25 and field “one-bedroom” +10 and field “one-bathroom +15]= Total $185

Field “condo-apartment” and field “every-month” = $45.00 [and field “kitchen” +35 and field “living-areas” +15 and field “one-bedroom” +5 and field “one-bathroom +10]= Total $110

Drop down field “Type of Home"

  • Single Family
  • Townhouse
  • Condo/Apartment

Drop down field “Type of Clean”

  • Every Week
  • Every Two Weeks
  • Every Month
  • Move In/Out
  • Deep Clean

Radio Buttons “Other Rooms”

  • Kitchen
  • Living Areas
  • Basement

Please Advise, Thank You!

1 Like

There might be a php way but jQuery should work for this. It should look something like this:

jQuery(document).ready(function($) {
	$( document.body ).on( 'change', '#field_35_1', function (){
		$var rate1 = $( '#input_35_1' ).val();
		$var rate2 = $( '#input_35_2' ).val();

		var total_rate = rate1 + rate2;
		$( '#input_35_3' ).attr( 'value', total_rate );
	});
});

I use a plugin called Snips and Scrips to insert it onto a page.

This was helpful to me with a complex pricing tree, but please note that the ‘$var rate1’ and ‘$var rate2’ syntax is incorrect within the Javascript. It should instead be:

jQuery(document).ready(function($) {
	$( document.body ).on( 'change', '#field_35_1', function (){
		var rate1 = $( '#input_35_1' ).val();
		var rate2 = $( '#input_35_2' ).val();

		var total_rate = rate1 + rate2;
		$( '#input_35_3' ).attr( 'value', total_rate );
	});
});
2 Likes

Crap, I Don’t know what I as thinking when I wrote that lol

1 Like