I'm trying to add a formula to my gravity form (WordPress) which includes exponent.i cant use the build in calculator since there is no exponent function. its basically a loan calculator where.
r=rate ;(form_id=4)/12
p=loan amount ;(form_id=1)
D=duration ;(form_id=2, [drop down menu]) * 12
X=p(r/1-(1+r)^-D)
X= repayment
Now I get the r, p and D from the form in form of drop down and written numbers.
so far I've put a HTML box and inserted this code in it :
<script>
gform.addFilter( 'gform_calculation_result', function(result, formulaField, formId, calcObj ){
if ( formulaField.field_id == "2" ) {
result = /****/;
}
return result;
});
</script>
I don't have any programming bg and I got it from a support team member.
What I understand is that this code will replace the calculation of field_id 2 (which is showing the X=[monthly repayment] with the result of my formula -> "/****/"
But i have to write the formula and i don't know how to get the values from the form with jQuery and put them in the formula.
I found out JavaScript math functions from W3school and another website so i don't have problem with writing the formula i just need help with jQuery to get the value.
I was wondering if someone can help me with that?