PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Use Value of Number Field Calculation

  1. kinetic
    Member

    I have a few number fields that I am performing calculations on sequentially. Number 1, then number 1 x 10%, then number 1 X 10% + number 1, etc - basically calculating a tax and a service fee then adding it all together.

    When I try to insert a previous number field into a field for calculation using the "insert merge tags" drop down, it doesn't seem to be capturing the value. Do I need to use the :value attribute?

    {number1:value} instead of just {number1}?

    I am currently using very large calculations involving over 100 fields in some cases and it is causing the form submission to surpass the max_execution_time in PHP.

    Posted 11 years ago on Monday May 28, 2012 | Permalink
  2. kinetic
    Member

    Here is more info on this issue:

    I have 3 fields in a test form.

    The first field is a basic product pricing field. The second is a number field that captures the subtotal of the product field). The third takes the "subtotal" and multiplies it by 10% to get a tax number. The fourth adds the subtotal and tax together to get a grand total.

    The issue is that if you change the quantity of the product, the subtotal field captures the value fine. But the tax field does not get updated. However, if you change focus to the subtotal field and hit a key – ANY KEY – then the tax field updates. If you tab into the field, then the value changes, triggering the grand total number field change as well. It is like it is waiting on a keydown event to begin running calculations that then trigger all the other number fields.

    TL;DR - then number fields are only updating on a keydown value when you are focused on one of them, rather than onchange event.

    Posted 11 years ago on Thursday May 31, 2012 | Permalink
  3. Hi Jeremy,

    I've sent you an email with an updated version of Gravity Forms which should address this issue. Thanks for the thorough description and example!

    Posted 11 years ago on Thursday May 31, 2012 | Permalink