Gravity Forms Populate Anything – Enable Dynamic Population

1644755730 Gravity Forms Populate Anything Enable Dynamic Population

This plugin is part of Gravity Perks, a suite of 37+ essential Gravity Forms addons with support you can count on.

What does it do?

GF Populate Anything allows you to dynamically filter and populate field choices and values with posts, users, taxonomies, terms, Gravity Forms entries, and databases. Pretty much anything! Choices and values can be filtered based on the values entered/selected in other fields allowing you to fetch and populate fresh, dynamic data as the user interacts with the form.

GF Populate Anything also provides support for Live Merge Tags which allows you to display dynamic, filterable data in your field labels, descriptions, and content.

Features

  • Dynamically populate field choices.
    Populate any choice-based field (e.g. Drop Down, Radio Buttons, Checkboxes) with dynamic, filterable data.
  • Dynamically populate field values.
    Automatically populate field values with dynamic, filterable data.
  • Dynamic filtering by user-specified input.
    Filter and populate fresh, dynamic data based on values/selections made in other fields.
  • Chain selects, radio buttons & more!
    Chain the available field choices based on selections in other fields.
  • Live Merge Tags.
    Add auto-updating merge tags anywhere inside your form (e.g. labels, descriptions, choices, values, HTML content).
  • Specialized, built-in data sources.
    Populate Posts, Users, Taxonomies, Terms, and Gravity Forms entries with specialized options for each. For everything else, populate directly from the WordPress database.
  • Flexible choice and input templates.
    Complete control over the populated value and label for choices and inputs.
  • Results preview.
    See the exact data that will be populated based on your filters right in the field settings.
  • Improve data accuracy.
    Improve accuracy by allowing users to select from an existing datasource rather than entering the information manually.
  • Automatic updates.
    Get updates and the latest features right in your dashboard.
  • Awesome support.
    We’re here to help! And we mean it.

Documentation

  1. How do I enable this functionality?
  2. Feature Details
    1. Populating Choices Dynamically
      1. Example Configuration
      2. Frontend
    2. Populating Values Dynamically
      1. Example Configuration
      2. Frontend
    3. Filtering Objects
      1. Filter Groups
      2. Filter Operators
      3. Filter Property
        1. Post
        2. Taxonomy Term
        3. User
        4. Gravity Forms Entry
        5. Database
      4. Filter Values
        1. Default
        2. Form Field Values
    4. Field Value Objects
      1. Example Field Value Object Configuration
    5. Live Merge Tags
      1. Fallback Modifier
      2. Example: Use Field Value in Another Field’s Label
      3. Example: Show Total in Submit Button
    6. Count the Number of Results
  3. Known Limitations
  4. FAQs
    1. Why aren’t users created with the Gravity Forms User Registration populating in my multisite?
    2. How do I display large entry queries?
    3. How do I add a placeholder or a blank space to the first populated option in a Drop Down?
    4. How do I add Checkbox Values as Choices?
    5. How can I differentiate similar items when populating into a Drop Down?
    6. How can I filter Posts those published in the last month?
  5. Hooks

How do I enable this functionality?

After GF Populate Anything is installed, you’ll want to enable “Populate Choices Dynamically” or “Populate Value Dynamically” for a given field in the Gravity Forms Form Editor. Here’s what that looks like when populating choices.


Feature Details

Populating Choices Dynamically

If you wish to dynamically populate a choice-based field’s choices, you can do so by enabling “Populate choices dynamically” in the field’s settings.

Example Configuration

In the example below, we configured a radio button field to have its choices dynamically populated with users who have the “Administrator” role.

Frontend

Here’s what the configured radio button field looks like on the frontend.

1644755723 923 Gravity Forms Populate Anything Enable Dynamic Population

Populating Values Dynamically

Populating values with GF Populate Anything is similar to how populating choices work. Enable “Populate value(s) dynamically” in the field’s settings and then configure it accordingly.

Example Configuration

In the example below, we configured a single line text field to have its value populated with the post title of the most recently added post.

1644755723 668 Gravity Forms Populate Anything Enable Dynamic Population

You can dynamically populate a field’s choices and value(s) if it supports choices!

Frontend

Here’s what the configured single line text field looks like on the frontend.

1644755723 300 Gravity Forms Populate Anything Enable Dynamic Population

Filtering Objects

Filter Groups

Create groups of conditions that filter which objects are populated into the field. Add a condition to your group with the (+)/(-) icons to the right. All conditions in a group must be true for the group to match. Add another group by clicking the “Add Filter Group”. Objects that match any group will be populated into the field.

1644755723 308 Gravity Forms Populate Anything Enable Dynamic Population

You can use the plus icon to add an AND filter condition. Adding Filter Groups creates an OR condition, but multiple filters in a single group are considered an AND condition.

Filter Operators
  • is
  • is not
  • > (greater than)
  • < (less than) * >= (greater than or equal to)
  • <= (less than or equal to)
  • contains
  • starts with
  • ends with
  • is LIKE
  • Available wildcards
  • % – Zero, one, or multiple characters
  • _ – Single character
Filter Property

Depending on the object type you select, you will have different properties to select from.

Post
  • Author
  • Parent Post
  • Post Content
  • Post ID
  • Post Status
  • Post Title
  • Post Type
  • Post Taxonomies (Dynamic)
  • Post Meta (Dynamic)
Taxonomy Term
  • Name
  • Parent Term
  • Slug
  • Taxonomy Term
  • Term ID
  • Term Meta (Dynamic)
User
  • Display Name
  • Role
  • User Email
  • User ID
  • User URL
  • Username
  • User Meta (Dynamic)

Security Note: On multisite installations, the User object type will only search users from the current site.

Gravity Forms Entry
  • Created by (User ID)
  • Entry ID
  • Fields (Dynamic)
Database

The Database Object Type’s properties are dependent on the table you select. Once you select a table, the properties will be all available columns on the MySQL Table.

1644755723 734 Gravity Forms Populate Anything Enable Dynamic Population

Security Note: On single site installations, the Database object type is only available to administrators.

Filter Values
Default

After selecting the filter property, the Filter Value dropdown will be populated with a list of values that apply for that property. For example, if you are populating posts into a field and add a filter condition for the “Post Status” property, the Filter Value dropdown would be populated with a list of available post statuses (e.g. Draft, Pending Review, Published).

Form Field Values

Objects can also be filtered by values entered by the user when the form is filled out. After selecting the filter property and operator, select the desired field from the Form Field Values option group. When a user enters a value into the specific field, the objects populated into this field will be filtered by that value.

Field Value Objects

One common use case with GF Populate Anything is populating field values from a field with dynamically populated choices. You can do this by manually configuring the Object Type and Filters to use field values, but an even easier way is to use a Field Value Object.

Field Value Objects are available on any field that supports values when there is another choice-based field that has dynamically populated choices on the same form.

Example Field Value Object Configuration

In the example below, we wired up a single text field to display the user ID of the selected user in the radio field above it.

The Fields

1644755723 386 Gravity Forms Populate Anything Enable Dynamic Population

The Selected User ID Field Settings

1644755723 985 Gravity Forms Populate Anything Enable Dynamic Population

The Frontend

1644755723 966 Gravity Forms Populate Anything Enable Dynamic Population

Live Merge Tags

When GF Populate Anything is activated, any merge tag prefixed with an @ will be automatically replaced when its associated field is updated. Live Merge Tags can be used anywhere within your form (labels, descriptions, choices, values, and HTML content).

Fallback Modifier

Live Merge Tags support a special modifier :fallback which can be used to display content when the merge tag does not have a value. For example, if the user can optionally provide there name but you want to greet them regardless, you could use, Hello @{Name:1.3:fallback[there]}. If a user entered their name as David, it would read Hello David but if the user entered no name, it would read Hello there.

Example: Use Field Value in Another Field’s Label
1644755723 442 Gravity Forms Populate Anything Enable Dynamic Population
Gravity Forms Populate Anything Enable Dynamic Population
Example: Show Total in Submit Button

1644755723 872 Gravity Forms Populate Anything Enable Dynamic Population

1644755723 226 Gravity Forms Populate Anything Enable Dynamic Population

Count the Number of Results

Use the {count} merge tag as a custom Value Template to populate the number of returned results instead of a value. This is useful for conditional logic where you want to show or hide a field based on how many objects exist.

For example, say you have an order form and the first 50 customers to purchase should receive a discounted price. Populate a hidden number field with the entry count.

1644755724 259 Gravity Forms Populate Anything Enable Dynamic Population

That count can be used with conditional logic to show a Discount field to the first 50 customers.

1644755724 618 Gravity Forms Populate Anything Enable Dynamic Population

The “Only Show Unique Results” checkbox applies to the {count} merge tag. Uncheck this to count all entries.


Known Limitations

  • Populating to/from List fields is not supported.
  • Dynamic checkboxes are not available when exporting form data.
  • When populating from custom database tables, the primary key must be the first column of the database.
  • Populating File Upload fields is not supported.
  • Using checkboxes as Form Field Values in filters is not supported
  • Live Merge Tags do not work with HTML fields in GravityFlow Workflows in the WordPress Admin
  • Live Merge Tags in field labels of the form connected to a WooCommerce Product with the WooCommerce Gravity Forms Product Add-ons do not render in the cart

FAQs

Why aren’t users created with the Gravity Forms User Registration populating in my multisite?

When a user is created with the GF User Registration Add-On in a multisite install, they aren’t given a primary_blog meta key in the database, and Populate Anything specifically looks for that key to determine which site they belong to.

Use the gppa_object_type_user_limit_to_current_site hook as a workaround.

How do I display large entry queries?

By default, Populate Anything will only display up to 500 entries to guarantee the best performance but we do have a way of increasing this number.

Use the gppa_query_limit hook to adjust the maximum number of results that can be returned in your query.

How do I add a placeholder or a blank space to the first populated option in a Drop Down?

You can use the Placeholder setting on the Appearance tab to add a default choice:

1644755724 975 Gravity Forms Populate Anything Enable Dynamic Population

Please note that Gravity Forms won’t let you add a space as the placeholder, but you can add a non-breakable space ( ) and it will create a blank choice.

How do I add Checkbox Values as Choices?

By default, Gravity Forms stores checkbox values as arrays separated by commas, and when Populate Anything pulls in those values, it populates them as they are stored. Luckily, we have a snippet that will populate checkboxes from an entry as choices:
GP Populate Anything: Checkboxes from an Entry as Choices

How can I differentiate similar items when populating into a Drop Down?

When populating items with the same or similar choice labels, you can differentiate between the similar items by following these steps:

  1. Activate the Enable enhanced user interface option on the Appearance tab.
  2. Set the Choice Template’s Label to a custom value by selecting “Add Custom Value” from the Drop Down and then entering a custom template. For example, this will show the post title and the post ID.
1644755724 665 Gravity Forms Populate Anything Enable Dynamic Population

The end result is a searchable Drop Down field with a unique identifier for each choice.

1644755724 162 Gravity Forms Populate Anything Enable Dynamic Population

How can I filter Posts those published in the last month?

Populate Anything’s results can be filtered on relative dates with this snippet. It adds merge tags that can be used as Custom Values in this format: {INTEGER UNIT ago}. For example, to filter Posts from a month ago, use the merge tag {1 month ago}.

1644755724 594 Gravity Forms Populate Anything Enable Dynamic Population

When a meta field is created with a custom field editor, such as Advanced Custom Fields, the newly created field is simply a placeholder. Until it is used in a post, it won’t be found by Populate Anything.

By default, Populate Anything has a 1000 record limit when accessing meta values for a Post. We have a snippet that will let you modify that limit. To use it, change 1000 to whatever limit you’d like to set.

Add the following CSS to automatically disable Multi-Page Navigation links while data populates.

Error fetching snippet.

Hooks

Gravity Forms has hundreds of hooks. Check out our Gravity Forms Hook Reference for the most thorough guide to Gravity Forms’ many actions and filters.

0 0 votes
Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
Shopping Cart
  • Your cart is empty.
Scroll to Top