Cognito Forms logo
Experience the future of Form Building Start Building Now!

Creating Conditional Prefilled Redirects!

Posted by Nadia A. 02/07/2017 Categories: Tips & Tricks

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 "" else if ChoiceField = "Form B" then "" else if ChoiceField = "Form C" then "" 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 (""). 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.

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

Prefilled links

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:

Have any questions about creating prefilled redirects, or Cognito Forms in general? Feel free to contact us, or just leave a comment down below!

Gravatar Nadia is the Inbound Marketing Coordinator for Cognito Forms. In her spare time, Nadia enjoys spending far too much time on YouTube, eating Swedish Fish, and cuddling with her two Chihuahuas.
Printable View