Welcome to the Instapage Support Center


Redirect to a different page depending on the dropdown option selected

Using custom code you can create almost any functionality on an Instapage landing page.

In the example below I will show you how you can redirect to a URL after form submission depending on the selected option from your form dropdown.

First I will create a dropdown in my form called "My Dropdown", and I will add in three options: "Option 1", "Option 2" and "Option 3".


I will setup so that if the visitor selects "Option 1" it will redirect him to our main website https://instapage.com. For "Option 2" we will send him to our Help Center -https://help.instapage.com/hc/en-us and "Option 3" will redirect to this article. 

Here you have code that you will need to add into your Settings -> JavaScript, Footer section:

(function() {
var selectInput = document.querySelector( 'form select[name="My Dropdown"]');
selectInput.onchange = function (e) {

// Option 1

if(this.options[e.target.selectedIndex].text == "Option 1"){
document.querySelector( 'form input[name="redirect"]' ).value = 'https://instapage.com';}

// Option 2

else if(this.options[e.target.selectedIndex].text == "Option 2"){
document.querySelector( 'form input[name="redirect"]' ).value = 'https://help.instapage.com/hc';}

// Option 3

else if(this.options[e.target.selectedIndex].text == "Option 3"){
document.querySelector( 'form input[name="redirect"]' ).value = 'https://help.instapage.com/hc/en-us/articles/214133067';}

})();// close ready

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.

The automatic prefilled form feature needs to be removed from the dropdown fields, as it would interfere with the snippet. It can be done by placing the following code under Settings - Javascript - Head.



$(document).ready(function() {
setTimeout(function() {
$("select").prop('selectedIndex', 0);
}, 2000);

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.




You can see a live example or download the example page and upload it to your own account below: 

Live Example Download

Have more questions? Submit a request
Was this article helpful?
8 out of 10 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!