Trying to figure out how to customize this form embed so that if the checkbox is selected, the user is redirected to Thank You Page #1 on form submit. If unchecked, the user is redirected to Thank You Page #2.
Struggling on manipulating the embed code, but this is what I have so far (my logic behind it, if nothing else):
Hi there, I'm also trying to redirect to a different thank you page based on a checkbox value (checkbox value indicates the product type they are requesting a demo of). Our SEO contractor needs this to do conversion tracking.
We use wordpress as our CMS. There are 4 product options and visitors can select one or as many as all of the checkboxes.
I don't have coding experience ... Anyone know if this code would work for us in the above scenario?
Would either of you happen to have any tips for implementing this within a form on a HubSpot landing page?
The built-it form module doesn't appear to allow adding JS. Also, It would seem that when instead try to use an embed script within a rich text module, it gets rejected if it contains any JS. Customer service said that rich text modules don't allow for JS.
@Albo you could download the legacy "Custom HTML" module from the marketplace - or - simply create your own custom module where you hard-code the form javascript as needed for the situation you're in.
@anders_grove is provides the example I would (though I like to access my form values via serialization as opposed to manually digging into specific DOM elements).
In addition to what he suggests - I would also disable the default redirect via adding an inlineMessage property to your form settings. That way - you don't run into "race conditions" where the default hubspot redirect may occur before the onFormSubmit callback runs (this shouldn't happen - but I generally like to safegaurd myself and explicitly set things when I customize redirect locations.
That also can let you put a default message in that says, "Thank you, please wait while we process your request..." or something to that effect - if for whatever reason the script hangs.
Hi! I'm trying to implement something like this and can basically only copy/paste other people's code since I have no Java experience. Does anyone have a working example of this?
An update to trying to figure this out. Still could use some help.
I'm attempting to replace the name of the input with the redirect values I want. The following still redirects me to the default redirectUrl despite checking the checkbox BUT my console logs reflect the replacement. Any ideas?
I'm facing the exact same issue. In my case I want to redirect based on a radio select value.
My specific use case is that my visitors click on a "free demo" CTA and then have 3 options for the demo (watch a video now, book a demo or start a trial) . Currently I have to take them to a dedicated page and then on to one of 3 landing pages. 3 submits is excessive!
Should I conclude that as there have been no replies, there is no way of doing this? It's a bit disappointing if that's the case.