QuForm AutoSum/Calculations

Home Forums Quform WordPress QuForm AutoSum/Calculations

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Ally 18 hours, 28 minutes ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23818

    orahchris
    Participant

    Hello,

    I’m attempting to use the Javascript guide here that assists QuForm in autosuming fields. However, it appears not to be working and I’m wondering if this has to do with the most recent update (field values). If you’d be so kind as to look at the following and verify everything looks ok? (Note the use of .keyup as we’re attempting to show the result live on the page without having to hit the submit button).

    <div id="form-total"></div>
    <script>
        jQuery(document).ready(function ($) {
            var calculate = function () {
                var total = 0.00;
     
               // A text input field with numeric value
                var val4 = $('.quform-field-3_26').val();            if (val4.length && $.isNumeric(val4)) {
                    total += parseFloat(val4);
                }
    		   // A text input field with numeric value
                var val4 = $('.quform-field-3_31').val();            if (val4.length && $.isNumeric(val4)) {
                    total += parseFloat(val4);
                }
     
                // Display the result to the user
                $('#form-total').text('Total: $' + total);
     
                // Set the value of the hidden field
                $('input[name=.quform-field-3_47]').val('$' + total);        };
     
            // Calculate on page load
            calculate();
     
            // Recalculate when these text input fields are changed
            $('.quform-field-3_26, .quform-field-3_31').keyup(calculate);
            $('.quform-field-3_26, .quform-field-3_31').blur(calculate);    
    
    });
    </script>
    #23892

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.