Redirect to a different page depending on the dropdown option selected

In this example, we created a dropdown in the form called "My Dropdown", and we added three options: "Option 1", "Option 2" and "Option 3".

image of dropdown form field

We set it up so that if the visitor selects "Option 1" it will redirect him to our main website For "Option 2" we will send him to our Help Center - and "Option 3" will redirect to this article.

This is the code that you will need to add to Settings -> JavaScript, Header section:

You will need to change the names "Option 1", "Option 2" and "Option 3" with your drop-down fields names and the URLs with the ones you want these fields to redirect to in your case. You will also need to change "My Dropdown" to the name of your actual field.

Make sure to include the procotol (https://) for all of the URLs. Example: use not just

If you need to add more lines to the code because your dropdown has more than three options, put a comma after each one except for the last line before the closing parentheses. 

Just keep in mind you also need to set a default redirect to one of the URLs you will add in the code. Click on the form, select Edit, then go to Submission, select Outside URL and enter your URL.

image of editing an outside URL by going to Submission, and selecting outside URL

NOTE: It is mandatory to set the default redirect as an outside URL in order for this to work, even if the page is an Instapage page.
NOTE: This code does not work for multistep forms.
NOTE: The "instapageFormSubmitSuccess" function can only be present on the page once, regardless of how many forms you have or how many actions you want to trigger after form submission. In case you have multiple snippets that need to fire after form submission, you must add all of them under the same Form Submit Callback function. If the snippets are not added under the same Form Submit Callback script, only the last function in the source code will be triggered.

You can see a live example below: 

Live Example

In case you need help with a custom functionality or any code customization that is not provided through our Help Center articles we have an Implementation Services team that can help our Convert users. The Convert plan includes Implementation Services as well as additional features and services that can be seen here: