There is anyway to do programmatically redirect the same form across multiple pages without require jQuery lib?
Like this solution just without jQuery:
There is anyway to do programmatically redirect the same form across multiple pages without require jQuery lib?
Like this solution just without jQuery:
Hey @ballonura
thank you for sharing this. I’ll tag a few experts that could help you.
Hey @stefen @SandyG1 @Jsum any thoughts you can share with @ballonura?
Thanks
Sharon
Thx @sharonlicari , i’ll w8.
![]()
@ballonura sure, you can use vanilla js to programatically redirect a user to a new page. Here’s an example that checks if the user submitted the form with a phone number and redirects to different pages depending on that:
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
portalId: "xxxxx",
formId: "xxx-xxx-xxx",
onFormSubmit: function() {
var phone = document.querySelector('[name="tel"]').value;
if(phone) {
window.location.href = "http://exammple.com/ty-we-will-call-you";
} else {
window.location.href = "http://exammple.com/ty-we-will-email-you";
}
}
});
</script>