Hi @alexidad. Have you tried what is described in another post here?
I have used this script and it will help us redirect to an alternative confirmation page for those who select a defined option in a dropdown.
Hope this helps 😊
Thanks, Finge!
I tried it and unfortunately it doesn’t work for me. I’m also using a Radio Button so the script may be different from the dropdown?
<script>
$("#type_of_property").live('change', function() {
switch ($(this).val()) {
case 'Commercial':
window.module.lp.form.data.url = "https://www.example.com/thank-you/";
break;
case 'Residential':
window.module.lp.form.data.url = "https://www.example.com/sorry/";
break;
};
});
</script>
Hey Alexidad,
That script requires a value being passed, a radio button only has a state to check against rather than the value you are looking for. You will need to tweak exactly when you want to fire the following code, but it checks against whether the required radio button’s state is checked or not and changes the redirect accordingly and updates whenever this radio button changes.
You will need to account for whether the user can avoid using the radio button at all and what the default form confirmation is too. The easiest method may be to set the form url to fail by default, thereby only being changed when a user selecting the correct radio button.
// WARNING - HERE BE AIRCODE! //
<script>
var radioButton = document.getElementById("radioButtonTheyMustSelectsID");
radioButton.addEventListener('change', function(){
if(radioButton.checked) {
window.module.lp.form.data.url = "https://www.example.com/thank-you/";
} else {
window.module.lp.form.data.url = "https://www.example.com/sorry/";
}
})
</script>
Hope that puts you on the right track!