Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in 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();
    });
    });

    in reply to: total calculation and sending #35158
    markavincim
    Participant

    I am sorry,

    the form is being submitted, the total value is not visible. I guess I’m making a mistake in the hidden field. It comes as hidden, it doesn’t come with value.

Viewing 2 posts - 1 through 2 (of 2 total)
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy