Calculate exponential value in Gravity Forms

I’ve been looking at the documentation of the program and can not find the option to perform exponential operations.

Is there any way?, Maybe with a script?

Read More

Thanks,

Related posts

Leave a Reply

1 comment

  1. Calculation field formulas don’t currently support exponents so you’re going to need to use the gform_calculation_result JavaScript hook along with JavaScript pow() and jQuery .val() to override the result of the formula.

    If your calculation field id was 2 and you wanted to calculate the value entered in field 1 to the power of 3 your script could look like this

    <script>
    gform.addFilter( 'gform_calculation_result', function(result, formulaField, formId, calcObj ){    
        if ( formulaField.field_id == "2" ){
            var num = jQuery('#input_10_1').val();
            result = Math.pow(num, 3);
        }
        return result;
    });
    </script>