Redirect to different success pages based on form dropdown selection
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:
Redirect to different success pages based on form dropdown selection
I know it's been two years BUT if you or anyone else is looking for this - here's the solution:
<!--[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){
setTimeout( function() {
var formval= $form.find('select[name="overall_how_satisfied_or_dissatisfied_are_you_with_our_company_"]').val();
if(formval =="Very satisfied" || formval =="Somewhat satisfied"){
window.location = "https://g.page/topjobasphalt/review?rc";
}
else{
window.location = "https://topjobasphalt.com/thank-you-for-your-feedback/";
}
}, 250 ); // Redirects to url with query string data from form fields after 250 milliseconds.
}
});
</script>
In our case, we send a customer satisfaction survey at the completion of a project, then anyone who says they are satisfied with the company will be sent to leave a review on Google. Otherwise, they will be sent to a thank you page.