Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
Javascript gravity forms, reference field

I need to add a js function into a gravity forms field. I want to take a result from an id=4 field, and add this number as input for a js function, then run the function:

var defaultRate = 1.7;
var halfRate = 1.65;

if (*field id=3* >= *field id=4* /2 ) {
  return halfRate;
} else { 
  return defaultRate;
},

and get the result as an output for my field. How do I refence them? Where do I paste the code? html field or custom js in settings?
I have seen this to use into custom js

<script>
gform.addFilter( 'gform_calculation_formula', function( formula, formulaField, formId, calcObj ) {
    if ( formId == '8' && formulaField.field_id == '13' ) {
        formula += '+5';
    }
    return formula;
} );
</script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is possible with Gravity Forms Advanced Calculations.

if ( F3 >= F4 ):
    1.65
else:
    1.7
endif;

The F3 and F4 refer to field IDs 3 and 4 respectively. If you find it clarifies the formula further, you could include the full or partial merge tag:

{:3} and {My Field:3}

{:4} and {My Other Field:4}

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!