Using Dynamic Population – Gravity Forms Support

  1. Home
  2. Blog
  3. Using Dynamic Population – Gravity Forms Support

Using Dynamic Population – Gravity Forms Support

Using Dynamic Population

Documentation » How To » Using Dynamic Population

Using dynamic population in Gravity Forms allows you to dynamically populate a field with a value (or values depending on the field type). This value can be passed via Query Strings, Shortcode and/or Hooks. This walk-through will give you and example of how to use each method of dynamic population to dynamically populate a field on your form!

Getting Started

There are three steps to configuring dynamic population:

  1. specify which field should be populated
  2. configure how the field should be populated
  3. determine what value the field should be populated with

To get started, let’s talk about specifying which field should be populated. To specify a field for dynamic population, just click the Allow field to be populated dynamically checkbox on the field’s advanced tab. Doing so will display a text field labeled Parameter Name. The value entered here will act as a reference to this field so Gravity Forms knows which field to populate.

Please note: avoid using a parameter name from this list of reserved WordPress terms.

Once you’ve entered your parameter name, you’re ready to decide how you want to populate the field.

Query String

You can populate a field via the query string by appending the dynamic population parameter you specified for the field to the end of your form URL along with your custom value.

Assuming that a Gravity Form is on the page at this URL, any field with the dynamic population parameter name your_parameter would be populated with the value value.

When is this method useful?

Let’s say you have a list of real estate agents you’re displaying on your website. Each agent has a link to a contact form so users can contact each agent directly. Instead of creating a separate contact form for each agent, you can add the agent’s email as a parameter to the contact form link and set up an email field to be dynamically populated by that parameter name.

Don’t want the dynamically populated field to be visible to the user so they can’t modify the populated value? Easy. Just check Admin Only under the Visibility option on the field’s advanced tab.


You can populate a field via the Gravity Forms shortcode by adding the field_values parameter. The field_values parameter accepts multiple dynamic population parameters separated by an ampersand (&).

[gravityform id=1 field_values=’parameter_name1=value1¶meter_name2=value2′]

In this example, any fields with the dynamic population parameter parameter_name1 would be populated with value1. Fields with the dynamic population parameter parameter2 would be populated by value2.

When is this method useful?

Dynamically populating by shortcode can be useful when you are creating different posts that use the same form but require a custom value depending on which post the form is displayed on.

Imagine you have a few events you’d like to register attendees for. You’ve set up a post for each event and want to use the same registration form for each, changing only the event name in the form based on the event post from which the user is registering.

To do this you would set the dynamic population parameter of the event field to something like event_name and then pass this parameter with the actual event name in the Gravity Forms shortcode like so:

[gravityforms id=1 field_values='event_name=My Awesome Event']


If you aren’t familiar with PHP and/or hooks, don’t be intimidated by this method for populating your fields. It’s really quite easy. Let’s start with this super basic sample code.

add_filter( 'gform_field_value_your_parameter', 'my_custom_population_function' );
function my_custom_population_function( $value ) {
    return 'boom!';

This snippet would populate any field with the parameter your_parameter with the result of the function my_custom_population_function. In this example, that function returns the string boom!. Explained as an equation… This + this = this!.

This snippet would be pasted in your theme’s functions.php file.

When is this method useful?

When isn’t this method useful? This method allows for the most flexible dynamic population but also requires a bit more knowledge to use. If you’d like to better understand this method check out the documentation on the gform_field_value_$parameter_name filter as well as a more detailed usage example.

, , , ,
Previous Post
How to Style Gravity Forms to Look Like Divi (+ Bonus Looks!)
Next Post
The WordPress Template Hierarchy – a visualization resource