Last week I wrote about a client project where I setup gravity form routing, today I want to write about gravity forms dynamic content.
We can dynamically pass data into a form to add to an entry, this is how you can do this.
What Is Dynamic Content?
Dynamic data is content that changes each time the form is loaded, it can be used on the display of the form or on the notification sent out when the form is completed.
An example; my client has a single form but wants to send a different PDF to form completors based upon which page they complete the form on, so we dynamically pass this data into the form so the notifications can be different.
Types Of Dynamic Content
There are two ways to pass data into a form and use them dynamically, query strings an via the shortcode.
A query string is a piece of data passed into the form on the URL of the page, here is an example.
In this example we are passing in a parameter name called referrer, and the data will be “somedata”.
The time you would use query string is if there is a single contact form page and you want to vary the data.
We can also pass data into the form via the shortcode we use to embed the form, again here is an example.
gravityforms id=1 field_values='referrer=somedata'
Again we are passing in some referrer data and that is “somedata”.
You would use the shortcode id if you had one form used on several pages and wanted different data based upon where it is embeded.
Setting Up A Field For Dynamic Content
When you add a field into a form you can make it populated dynamically.
Go to the advanced settings and there is a check box to make it dynamic then you add the parameter name you want to collect data from.
You can have multiple dynamic data fields on a site.
Using Dynamic Data
Once you have captured your dynamic data you can use it in logic on the form for example to set prices, or pass it into notifications.
In my example above I passed a download link to the customer notification email
Wrap Up – Gravity Forms Dynamic Content
If you need to pass data into your form before it is submitted dynamic data fields is the thing you need.
If you need help setting up a complicated gravity forms get a no obligation quote.