Using merge tags inside choices values

Hi there!

For a client’s project I’m trying to have a dropdown field with Labels and Values, and inside the values use merge tags, specifically custom_field to pull data from the post where the form is embedded.

The thing is that the custom_field and embed_post merge tags are not applied/replaced for the values of the dropdown.

Digging a bit in the code, seems like the method replace_variables_prepopulate, which does that job, is not applied to the choices (common.php → get_select_choices function)

Anyone has an idea if this is intentional or a defficiency, and/or if there’s any other way to have those merge tags available for a dropdown value?


Hi Serafin,

This should be possible with our GP Populate Anything Perk. This will allow you to populate any field on the form with data in custom fields from the current post. This doesn’t require coding and you will be able to set it up within the form editor. If you have any questions, you can get in touch here.


Thanks Samuel, but I don’t think installing a whole new plugin for something like this is the best approach.

It seems to me like it should be something supported by GF natively, since the core plugin provides that merge tag initially.


Serafin, using merge tags to populate field values is only supported for fields having the Default Value setting. This is not the case for choice based fields like the drop down field. As you found already, adding the merge to the choice value is not going to change this.

Using the GP Populate Anything Perk would be the only ready to use solution that we’re aware of for an use case like this.

If that doesn’t fit your needs, you can create your own custom dynamic population code to get the values from your post custom field and populate the drop down choices accordingly. The following tutorial shows you how to start with a customization like this: Dynamically Populating Drop Down, Radio Buttons or Multi-Select Fields - Gravity Forms

Thanks for your time, Samuel.

I’ll check it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.