Home › Forums › Quform WordPress › Multiply
- This topic has 6 replies, 2 voices, and was last updated 7 years ago by
ArieNuis.
- AuthorPosts
- August 27, 2018 at 1:42 pm #26826
ArieNuis
ParticipantHi,
I have used the following link https://support.themecatcher.net/quform-wordpress-v2/guides/advanced/calculations
to make some calculations and it works perfect! See https://www.dfd.nl/inboedelwaardemeterNow i want in the last field “Totaal inboedelwaarde: ” to make a multiply from field “Totaal aantal punten:” X 1012
Do you have an excample/solution for this?
This is the JS calculation in use:
jQuery(function ($) {
var calculate = function () {
var total = 0;// Check if a checkbox is ticked
if ($(‘.quform-field-15_3_1’).is(‘:checked’)) { total += 20;
}// A radio button
var val4 = $(‘.quform-field-15_23:checked’).val();
if (val4 == ’35 jaar en jonger’) {
total += 22;
} else if (val4 == ’36 tot en met 50 jaar’) {
total += 29;
} else if (val4 == ’51 tot en met 70 jaar’) {
total += 39;
} else if (val4 == ’71 jaar en ouder’) {
total += 37;
}// A radio button
var val2 = $(‘.quform-field-15_36:checked’).val();
if (val2 == ‘Alleenstaand’) {
total += 0;
} else if (val2 == ‘Gehuwd/samenwonend’) {
total += 10;
}// A radio button
var val4 = $(‘.quform-field-15_43:checked’).val();
if (val4 == ‘Tot en met € 1.000,-‘) {
total += 0;
} else if (val4 == ‘€ 1.001,- tot en met € 2.000,-‘) {
total += 10;
} else if (val4 == ‘€ 2.001,- tot en met € 3.000,-‘) {
total += 17;
} else if (val4 == ‘€ 3.001,- tot en met € 4.850,-‘) {
total += 28;
}// A radio button
var val4 = $(‘.quform-field-15_50:checked’).val();
if (val4 == ‘Tot en met 90 m2′) {
total += 0;
} else if (val4 == ’91 m2 tot en met 140 m2’) {
total += 6;
} else if (val4 == ‘141 m2 tot en met 190 m2’) {
total += 18;
} else if (val4 == ‘191 m2 tot en met 300 m2’) {
total += 23;
}// Display the result to the user
$(‘#form-total’).text(” + total);// Set the value of the hidden field
$(‘.quform-field-15_5’).val(‘$’ + total); };// Calculate on page load
calculate();// Recalculate when these checkboxes/radio buttons are clicked
$(‘.quform-field-15_3, .quform-field-15_23, .quform-field-15_36, .quform-field-15_43, .quform-field-15_50’).click(calculate);
});August 29, 2018 at 2:12 pm #26856Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 7 years ago by
Ally. Reason: Fix code error
August 30, 2018 at 10:03 am #26871ArieNuis
ParticipantThanks Ally!
Your code was not complete.
But when i put this line after your code then it works!$(‘#form-total2’).text(” + total2);
Regards,
Arie Nuis
September 3, 2018 at 9:32 am #26887Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 5, 2018 at 2:28 pm #26929ArieNuis
ParticipantHi Ally,
Simple question as a follow-up;
How can i put these values in a e-mail confirmation? Total and total2.Regards,
Arie Nuis
September 6, 2018 at 4:58 pm #26937Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 7, 2018 at 12:29 pm #26942ArieNuis
ParticipantThanks Ally,
Works great!
Regards,
Arie
- This reply was modified 7 years ago by
- AuthorPosts
- You must be logged in to reply to this topic.