Connecting Two Caldera Forms Using Passback Variables

Caldera Forms Banner

Passback variables in Caldera Forms are used to add query string parameters to the URL that a form redirects to on success. This allows you to pass data from one form to another, whether that form is a Caldera Form or not. They can also be used to triggering analytic events.

Query string parameters are those values you see in a URL after the “?” and are interpreted by PHP as “GET” variables. For example, in the URL “example.com/thank-you?first_name=josh&last_name=pollock” we have a query string parameter called “first_name” with the value of “josh” and a query string parameter called “last_name” with the value of “pollock.”

Creating And Using Passback Variables

In the Caldera Forms form editor, there is a “Variables” tab. In that tab you can create different types of variables. If you wanted to create a variable called “first_name” and have it populated with the value of a field with the slug “first” you would could do it like this:

Screen Shot 2016-05-13 at 3.44.55 PM

Note, this is using a field value magic tag. For more information, on magic tags in Caldera Forms, read this page.

Now, add a redirect processor to your form. When the redirect happens, your passback variables will be used.

IMPORTANT If you use passback variables, and experience odd behavior on the redirect, it is likely that you have used a query string parameter that WordPress is looking for. For example, if you added a passback variable called “name”, this will likely cause WordPress to try and load a page with that name. Using a passback variable called “name” is a bad idea when the redirect processor leads to a WordPress site, unless you are intentionally trying to select a specific page.

Using The Passback Variable In The Next Form

Now that you have the data you need in the URL, you need to get it into your form on the next page. In Caldera Forms, you can use a {get:*} type magic tag to set the default value of a field or the value of a hidden field.

Therefore, if you have a form that creates a passback variable called “first_name” in the second form, you could set a field’s default value to {get:first_name} to “get” the value of first_name and set it as the default value.

If the page you are redirecting does not use Caldera Forms, these query string parameters are available using the PHP GET super variable.

Using Connected Forms

The Connected Caldera Forms add-on connects multiple forms into one sequence. Since this add-on does not do full page re-directs between forms, passback variables are not useful until the sequence is complete.

In a connected form, you can access data from a previous form using a {prev:field_slug} magic tag. See this page for more information.