Redirect to different success pages based on form dropdown selection

Regular Contributor | Gold Partner

I'm trying to configure the form on this page so that depending on which option is selected in the dropdown field, it will send them to a different landing page:
https://info.marketingninjas.com/seg-evr-project-type

 

For example:

  • if the user selects the Homebuilder option, it will redirect to Landing Page A. 
  • if they select the Remodeler option, it will redirect to Landing Page B
  • and so on...

I found this code on a different thread that was trying to accomplish the same thing based on a checkbox field in the form:

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
	portalId: "#######",
	formId: "########",
	onFormSubmit: function($form) {
            if($form.find('input[name="current_giving_customer"]').prop('checked')){
                window.location.href = "https://google.com/";
            }else{
                window.location.href = "https://npr.org";
            }
        }
});
</script>

I understand the If/Else logic in the code above.  But is it possible to modify the code so that it will be:

  • If value = New Homes, then go to LP A
  • If value = Remodeling, then go to LP B
  • If value = Developer, then go to LP C
  • If value = Commercial, then go to LP D
  • If value = Other, then go to LP E
  • If value = Not a builder, then go to LP F

Thanks so much for your help. New to this and still learning. 

Reply
0 Upvotes
1 Reply 1
Highlighted
Regular Advisor | Silver Partner

Hi @JeffSchneider 

 

Haven't tried it myself BUT...

 

I would try the onFormSubmit or onFormSubmitted methods (see link) and to perform a redirect in a Switch/Case Statement.

 

https://developers.hubspot.com/docs/methods/forms/advanced_form_options

 

There may be some other JavaScript that could work for you.

 

Have fun

Mike