Skip to main content

We have two product options (one-time and subscription) and we would like to redirect the user to a specific URL based on their radio selection when they hit the submit/buy button. These options are being displayed inside of a Unbounce Popup.


From my understanding this isn’t possible inside of Unbounce without some sort of custom JavaScript or a third-party form. We’ve got a switch statement working when the radio button is chosen but it happens immediately, and we would like this to be based off the submit button click.


Below is the switch statement we are working with and we just need to find a way to wrap, or base it off a submit/click function. Regular submit/click functions don’t seem to be working we think because of limitations on the Unbounce platform.


<script>

$(“inputname=‘productoption’]:checked”).live(‘change’, function() {


switch ($(this).val()) {


case 'Subscribe & Save':
window.parent.location.href = "our unique URL A";
break;
case 'One-Time Purchase':
window.parent.location.href = "our unique URL B";
break;

}


});



The above code is working when the user selects a radio button but it happens immediately, rather than when the submit button is clicked.


Thank you in advance!

Apparently my code has been working this whole time. Probably a cache issue or something. Hopefully this helps someone trying to accomplish the same thing. Again, this redirects the user to a specific URL based on radio selection.


<script>
$("input[name='productoption']:checked").live('change', function() {
switch ($(this).val()) {
case 'Subscribe & Save':
window.module.lp.form.data.confirmData = "our unique URL A";
break;
case 'One-Time Purchase':
window.module.lp.form.data.confirmData = "our unique URL B";
break;
}
});
</script>

The only thing that changed from my previous post was the line starting with “window.module…” and the reason I had changed that initially was because it was loading the external URL inside of the modal window, so I was attempting to load it inside of the parent.


Make sure you modify oname=""] to match your radio button input name. And “Subscribe & Save” represents the value of the radio button input.



  • Cheers


Hi there, I’m trying to use your script for the exact same purpose (purchase options) and am sending them to a ThriveCart page depending on which option they choose. However, I can’t get it to work.


Here’s what I’ve got:


I also tried switching the window.module… line to window.module.lp.form.data.url but no luck.


Any ideas?


@Hristian - you’ve fixed my problems before… am I missing something stupid?


Reply