I’ve recently had a client ask if it was possible to populate specific Caldera Formsย form fields based on a product selection on another page. In this case, the client has a small number of products which each have their own page and if a visitor wants to query a specific product, the client wants them to be able to click an “enquiry” button which will then take them to a page with a Caldera Forms form on it where the product they are enquiring about is already selected.

Fortunately for us, Caldera Forms supports this kind of functionality. By using the Get Magic Tag, you can set the value of one or more fields by adding values to the end of a URL. These areย referred to as โ€œquery string parametersโ€ and are always in field=value pairs.

Set Up The Form

The first thing you’ll need to do is set up the Get Tags on the form you’re working with. This is quite simple and all you need to do is add “{get:field_name}” to the default value of the field or fields you’re wanting to populate.

In the example above I’ve used the slug in the default option as the field name. You’ll also see in the example that you can select a specific option from a dropdown field.

Building the Query String

 

Once you’re done setting up the form, you’re ready to build the query string. Head to the page you going to call the page from and add a button. Now link to the page with the form on and add the field=value pairs to the end of the URL. In my case, I used the URL looked like this:

You’ll see that at the end of the URL I’ve added a question mark followed by the name=value pair. You can have more than one name=value pair, they must just be separated by commas. If the value has any spaces, replace the space withย %20.

Wrapping it Up

That’s pretty much all there is to it… easy hey?

Support Divi Notes

Divi Notes started as a way to document my own WordPress and Divi web design/development journey and, to my delight, has grown to become a helpful resource to many other Divi users out there. If you’ve found Divi Notes to be useful in your journey, I’d appreciate it if you would consider supporting me using the form below.

$
Personal Info

Donation Total: $4.99