Skip to main content

Has anyone tried to do a script to exclude inquiries once they selected an option?


We’re trying to figure out if we can filter leads from Unbounce’s form.


What we want to do is to send those who select Option B to a sorry page - mentioning that they aren’t qualified because we can only provide services for Option A type of inquiries. We can’t just put a limit to where these leads come from - time after time the campaign will get Option B type of leads.


Anything you can suggest to help us with this dilemma? Most of the posts I see here mostly request the feature to show more fields, etc. Let me know if I missed anything!

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!


Reply