1

プログラムのドキュメントを見てきましたが、指数演算を実行するオプションが見つかりません。

何か方法はありますか?, 多分スクリプトで?

ありがとう、

4

1 に答える 1

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.

計算フィールド ID が 2 で、フィールド 1 に入力された値の 3 乗を計算したい場合、スクリプトは次のようになります。

<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>
于 2014-05-15T21:14:06.387 に答える