bookmark_borderUsing Confirmation Query Strings to Populate a Form Based on Another Submission

Say, for example, you have two forms. The first form is used to capture general customer information, and the second is used to create a new user account on your site. Instead of creating an account with the first form using the user registration add-on, you would rather only register the user with the second form.

In this scenario, it can be a bit of a pain for the customer to need to enter their information such as name and email twice. This is where confirmation query strings come into place and allow you to pre-populate the second form based on the first form’s submission.

In this article, we will show you how to read the data from the first form, to automatically populate fields on the second form.

Setting up the first form to send data using confirmations

To begin reading data from the first form, it must output the data in some way to allow the second form int he process to read from it. This is where confirmation query strings come into play. In this section, we will show you how to set up confirmation query strings to be passed from the first form to the second.

  1. confirmation-prepop-1First, you will need to access your first form that will be entered by the user. In this example, we will be using a general customer information form.
  2. form-settings-confirmationsNext, hover over Form Settings and click on Confirmations. Select an existing confirmation, or add a new one. Most users would simply edit the default confirmation.
  3. confirmation-prepop-3Once here, select the Redirect option for the Confirmation Type. This is because instead of simply displaying a confirmation message, we need to redirect data to the secondary form.
  4. confirmation-prepop-4In the Redirect URL field, enter the URL of your secondary form. If you have not already created a second form, go ahead and do so as well as embed it within a page and obtain the URL for that page.
  5. confirmation-prepop-5Next up is the most critical part of the form, the Redirect Query String option. This option will allow you to pass submitted data from the the first form over to the second one. Enable this option by clicking the checkbox.
  6. confirmation-prepop-6When you selected the Redirect Query String option, a new field appeared in which you will now enter your query strings. This will be formatted such a way that you will have a variable containing a variable. The contents of these variables will be populated using merge tags. For example, it will look something like this:
    first_name={Name (First):1.3}&last_name={Name (Last):1.6}

    In the example above, we are creating variables for first_name and last_name, and assigning them to the corresponding submitted fields using merge tags. As we have multiple variables here, they are separated with an & symbol. To review and insert available merge tags, click the merge tag icon to the right of the field.

  7. Once all of your fields are configured to send the appropriate query strings to your secondary form, save your settings and continue on to the next steps to set up the second form that will receive the submitted data from the first.

Setting up the second form to receive the submitted data

Now that your first form is configured properly to send the submitted data via a query string, you will now need to set up the second form the receive that data and automatically populate fields from it.

  1. confirmation-prepop-7Begin by accessing the second form that will receive data from the first.
  2. confirmation-prepop-8Once you have done so, select a field that you would like to be automatically populated. In the screenshot to the right, we would like the Name field to be automatically populated.
  3. confirmation-prepop-9From within your selected field, click on the Advanced tab and select the checkbox labeled Allow field to be populated dynamically. This will allow the field to become populated based on the data sent to it.
  4. confirmation-prepop-10Now that dynamic population has been enabled for this field, you will simply need to map the query string variables that are sent in the first form, to be accepted and used in the second form. In the prior example that we used, the First Name field was set to the first_name query string variable. To allow the second form to accept and use this query string, simply enter first_name into the box labeled First, under Parameter Name. Of course, the exact information you will enter here will vary based on the query strings that you have created earlier.
  5. That’s all there is to it. Any fields you configure this way will now become automatically populated based on the content you have configured them to receive from the initial form submission.

You should now have a solid understanding of how to dynamically populate a form based on another form’s submission.