Fill a dynamic text field with the title of a post

I’m on a post with the title 'Example"
I put on my post a button to go the gravity form.
I’d like, on my form, fill a text field automatically with the post title.
I tried to pass the parameter in my url => event=post_title or event=$title… but it isn’t the correct syntaxe.

Hi Stéphane. On the button where you link to the Gravity Forms form, you have control over the URL and parameters. That is where you need to add the parameter. I assumed you are doing this for a lot of pages, and only one form, so adding the post title manually to the link will not be scalable. How are you adding the button to the post? Is that done with a content block or are you doing that in a theme template file? That is where you will need to grab the post title, and append that with a parameter, when you send to the form.

Then, the form will need to be set up to catch that post title. Here is how you set up the form field to catch that parameter value: Dynamically Populating a Field - Gravity Forms Documentation

If you want to avoid all that, you can capture the URL of the page that the visitor was on before they landed on your form (that will be the page where they clicked the button to get to the form.) Add a single line text field to the form, and on the Default Value, use these merge tag:


Documentation: {referer} Merge Tag - Gravity Forms Documentation

That will capture the full URL. If you need only the page title, then you will have to do as I explained initially. If you have any questions, please let us know.

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