Creating Conditional Prefilled Redirects!

Nadia Afshar By Nadia Afshar | February 7, 2017

There are a ton of ways to customize your form’s confirmation page - including the option to instantly redirect your users to a specific page after they submit their form. You can redirect your users to any Url; whether it’s a page on your website, or another Cognito Form. In the latter case, you can actually use a prefilled code to transfer field data (Name, Email, Address, etc.) from one form onto another. And, with the help of some conditional logic, you can even send your users to a different prefilled form depending on the information they submit!

Conditional Redirects

First, we need to determine the criteria that redirects users to different Urls:

  1. Add a Calculation field to your form set to Text type. Make sure to set this field to Internal view only.
  2. For your calculation, use a simple if/then statement:

= if ChoiceField = "To Google" then "http://www.google.com/" else if ChoiceField = "Form B" then "https://www.cognitoforms.com/MyOrganization/FormB" else if ChoiceField = "Form C" then "https://www.cognitoforms.com/MyOrganization/FormC" else ""

This expression outputs a specific Url depending on which option a user selects from a Choice field on your form. So, if a user selects “To Google”, the calculation will output the corresponding Url (“http://www.google.com”). If a user selects Form B, then the calculation will output the Url to Form B. You can adjust this calculation as needed to match your specific criteria.

  1. Lastly, don’t forget to open up your form preview and test out your calculation:

With our conditional logic now set up, it’s time to write our prefill code:

  1. Select Redirect Url in your form’s confirmation options (located in Submission Settings).

  2. Insert the redirect calculation field that you just created (ours is named “Redirect To”):

  3. Write your prefill code directly after the inserted redirect field. If you’re not familiar with prefill syntax, our help topic has some quick tips to help you get started. Basically, you just need to specify which field data you want to transfer over, and then insert those fields into your code:

  4. Save your changes!

Redirect Your Users

Now, when a user selects a specific choice option and submits their form, they’ll be redirected to a corresponding form that’s already prefilled with their submitted data:

Set up conditional prefilled redirects on your forms.
Learn More

Nadia Afshar

Nadia Afshar

Nadia, the Technical Writer for Cognito Forms, develops documentation, support content, and how-to videos. No matter your experience – with her help, you'll be able to take full advantage of the product. In her spare time, Nadia enjoys listening to French house, drinking coffee, and talking about herself in third person.

Cognito Forms allows you to easily build powerful forms. Sign Up Now
Blog