First see that post:
Get value with JQuery in gravity form
i'm trying this code but... nothing happend. Step by step i did:
- Fresh WP installation.
- Install Plugin Gravity Forms
- Create Form1 (Id of form = 1)
- Create Form2 (Id of form = 1)
- Add 5 number fields to Form2 (ids of fields are: 1,2,3,4,5)
- Add HTML field
Put this code on HTML field:
<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>
Save changes to Form2.
- Clicked to preview of Form2
When writing the value 10 in the field (field ID = 5), the value of the field (field ID = 2), should appear with the value 120.
But nothing happens when I show the form and complete the fields.
What am I doing wrong?