I’m trying to configure a HubSpot form to redirect to a URL if a field is checked. I also want the same form to redirect to a different URL if the field is unchecked.
How would I make the redirectURL into a conditional statement based on whether or not a box is checked?
Tried a few options but now out of ideas. At one stage I got it to redirect, but wouldn’t pick up any form submissions via Safari.
Failed attempt below.
<!--[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: ************",
onFormSubmitted: function($form) {
if($form.find(‘input[name=“property name”]’).prop(‘checked’)){
window.location.href = “URL 1”;
}else{
window.location.href = “URL2”;
}
}
});
</script>