Reply To: total calculation and sending

Home Forums Quform WordPress total calculation and sending Reply To: total calculation and sending

#35159
markavincim
Participant

Maybe I solved it. I defined the button function and it worked. maybe it will help someone. I leave the codes here.

I would appreciate if you let me know if there is any mistake.


jQuery(function ($) {
var calculate = function () {
var total = 0;

// A radio button
var val3 = $('.quform-field-5_15:checked').val();
if (val3 == 'enforcement') {
total += 25;
} else if (val3 == 'justice') {
total += 0;
} else if (val3 == 'courtesy') {
total += 0;
} else if (val3 == 'instance') {
total += 0;
} else if (val3 == 'fairness') {
total += 0;
}

// B radio button
var val3 = $('.quform-field-5_5:checked').val();
if (val3 == 'persuade') {
total += 25;
} else if (val3 == 'provide') {
total += 0;
} else if (val3 == 'permit') {
total += 0;
} else if (val3 == 'preserve') {
total += 0;
} else if (val3 == 'promote') {
total += 0;
}

// Display the result to the user (optional)
$('#form-total').text('Aldığınız Puan:' + total);

// Set the value of the hidden field (optional)
$('.quform-field-5_3').val('Puan: ' + total).triggerHandler('change');
};

$('.quform-button-submit-5_2').on('click', function () {
calculate();
});
});

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy