• Resolved kehorn99

    (@kehorn99)


    Love this plug-in. One of 10 most important plug-ins for WordPress! Fills a much needed gap in WP. And I love your customer support.

    I’m using this script referenced in other forum posts to pass field content from one form to another using CSS classes.

    <script>
    jQuery(document).on(‘change’, ‘.my-source-field input’, function(){
    jQuery(‘.my-destination-field input’).val(jQuery(this).val()).change();
    });
    </script>

    Seems to work flawlessly for a NUMBER field but does not update dynamically in the destination form when the result in a CALCULATED FIELD that is passed from the Source to the Destination form changes as a result of changes in the Source form. The script does dynamically update the destination field of the CALCULATED FIELD when a NUMBER field that is passed via this script changes that affects the calculation, but apparently ONLY in that event. It does not change when the CALCULATED FIELD changes as the result of other calculations in the source form.

    Is there a way to update the content dynamically ANY TIME that source-CALCULATED FIELD changes?

    Thanks again for the GREAT plug-in!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @kehorn99

    The equations associated to the calculated fields are evaluated dynamically. So, if you assign the value of a field in the form A to a calculated field in the form B, you would lose this value when the equation of the calculate field be evaluated.

    For this reason we recommend to populate number fields or hidden fields in the form B, and use these fields in the equations associated to the calculated fields in the form B, and not assign the values directly to the calculated fields in the form B.

    Best regards.

    Thread Starter kehorn99

    (@kehorn99)

    Clarification: I was, in fact, using Hidden fields in Form B. I’ve now made the Form B destination fields Number fields so that I can easily view when the fields update. I now see that the script is correctly updating the Form B fields dynamically regardless of field-type.
    The problem is that my test CALCULATED FIELD in Form B (which sums the two NUMBER fields that are deriving their values from Form A fields) is NOT dynamically updating when the content of the fields in the OPERATION contained in the CALCULATED FIELD change. More accurately stated, when the content of the Form B field changes as a result of a change of a NUMBER field in Form A the result in the CALCULATED FIELD in Form B (with an operation based on two destination number fields) immediately dynamically updates. When, however, the other field changes (based on a change of a dropdown field in Form A) the calculation does NOT update despite the fact that the value changed in the field in Form B used in the operation in the Form B calculated field.
    Specifically … I have fieldname9 and fieldname10 (both number fields) in Form B that are updating dynamically when the source fields change. I also have a CALCULATED field (fieldname8) containing this operation: SUM(fieldname9+fieldname10) When I change the Form A quantity field that updates fieldname9 the result in fieldname8 changes. When, however, I change the DROPDOWN in Form A that dynamically changes fieldname10 (I can see it change in Form B) … the fieldname8 does NOT dynamically update. The operation does not run in that event.
    Can this be remedied so that fieldname8 always updates when the value of fieldname 9 and/or fieldname10 changes? I’m puzzled.

    Plugin Author codepeople

    (@codepeople)

    Hello @kehorn99

    Please, edit the block of code into the “HTML Content” field as follows:

    
    <script>
    jQuery(document).on('change', '.source-quantity-1 input', function () {
        jQuery('.destination-quantity-1 input').val(this.value);
        setTimeout(function () {
            jQuery('.destination-quantity-1 input').change();
        }, 50);
    });
    jQuery(document).on('change', '.source-ingredient-1 input', function () {
        jQuery('.destination-ingredient-1 input').val(this.value);
        setTimeout(function () {
            jQuery('.destination-ingredient-1 input').change();
        }, 50);
    });
    </script>
    

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Passing field results between forms’ is closed to new replies.