Firstly, I am by no means versed in JavaScript or jQuery. In doing so, I use Gravity Forms to create a savings calculator that contains exponents. I found this stream , but I don’t understand how it works when calculating the exponential value.
Here is my setup:
I have 3 custom fields:
- Principal amount
- Interest rate
- The number of monthly payments
Actual calculations are hidden from the user. Two formulas are immediately calculated here. Firstly, it’s “User Calculations,” which work to find “Common Interest.” The second is “Fixed calculations” with a fixed interest rate of 1.95% instead of a custom field working for the same purpose. A fixed bid to the side, both formulas are identical, and the results of which are included in the final formula, free of exhibitors. Fortunately. Here are the first three “Number” fields (name and formula) after user input:
'CALC'<br> ( {Interest rate::2} / 12 ) / 100 'MP exponent' ( 1 + {CALC:8} ) <---This is the formula that requires an exponent equal to the user-defined "Number of monthly payments" field. 'MP numerator' {CALC:8} * {Principal amount::1} * {MP exponent:10}
The formula continues and includes the MP exponent field several times. Given my case, can I use the above script (unedited from my original post):
<script> gform.addFilter( 'gform_calculation_result', function(result, formulaField, formId, calcObj ){ if ( formulaField.field_id == "2" ) { var field_five = jQuery('#input_2_5').val(); result = field_five * 12; } return result; }); </script>
... for my calculation? I'm not quite sure how to indicate something like this in 4 separate fields ... I understand that this may not be possible with Gravity Forms - or, of course, not easy - so I really appreciate any help the community can give me to offer.
javascript jquery wordpress gravity-forms-plugin
30hourdays
source share