Gravity Forms: Populate State from a ZIP Code

Let’s say you have a form with a ZIP Code field and want to automatically populate the state from it (without asking the user to fill it).

1. ZIP field:

2. Hidden “State” field:

3. Take note of 3 IDs: FormID, ZipID, StateID

In our example:

  • Form ID: 15
  • ZIP ID: 2
  • State ID: 3

4. Add to your theme’s functions.php:

Change the numbers 15, 2, 3 to your actual IDs (lines 4 and 6):

Close Menu