• Resolved detanatar

    (@detanatar)


    On one page there are 3 calculators in different accordion blocks.
    Each calculator has its own result.
    Is it possible to do mathematical operations between these results?
    
    For example
    I need to display the sum of these results in the fourth accordion block
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @detanatar

    Yes, that’s possible but requires some extra code.

    – Assign a unique class name to the fields in the different forms, for example, field-a, field-b, field-c

    The class names are assigned to the fields through the attributes “Add CSS Layout Keywords”.

    – Insert three hidden fields in the fourth form to receive the values of the external fields, and assign them unique class names too, for example, field-d, field-e, field-f

    – Insert an “HTML Content” field in the fourth form with the following piece of code as its content:

    
    <script>
    jQuery(document).on('change', '.field-a input', function(){
    jQuery('.field-d input').val(this.value).change();
    });
    jQuery(document).on('change', '.field-b input', function(){
    jQuery('.field-e input').val(this.value).change();
    });
    jQuery(document).on('change', '.field-c input', function(){
    jQuery('.field-f input').val(this.value).change();
    });
    </script>
    

    – Finally, use the hidden fields in the fourth form with the equations defined in the calculated fields of the fourth form as usual.

    Best regards.

    Thread Starter detanatar

    (@detanatar)

    does not work

    Plugin Author codepeople

    (@codepeople)

    Hello @detanatar

    Please, send me the link to the page that includes the forms.

    Best regards.

    Thread Starter detanatar

    (@detanatar)

    Plugin Author codepeople

    (@codepeople)

    Hello @detanatar

    The onchange event is being captured by a different code on your page. Please, use the keyup event instead.

    Please, replace the code into the “HTML Content” field with the following one:

    <script>  
    jQuery(document).on('change', '.field-a input', function () {
        jQuery('.field-d input').val(this.value).keyup();     
    });
     jQuery(document).on('change', '.field-b input', function () {
        jQuery('.field-e input').val(this.value).keyup();     
    });
     jQuery(document).on('change', '.field-c input', function () {
        jQuery('.field-f input').val(this.value).keyup();     
    });
    </script>

    Best regards.

    Thread Starter detanatar

    (@detanatar)

    working
    super

    Thread Starter detanatar

    (@detanatar)

    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘mathematical operations between calculators’ is closed to new replies.