Form Redirect Based on Dropdown Field Value



Show first post

42 replies

Hi! Does anyone has the solution for this? I tried to copy the scripts you wrote in the conversation but it’s still not working in my page.

Thanks!

Can you do this on a text field using a number range?

Example:
<20 goes to url1, >20 goes to url2

Checking in!
Has anyone figured this out?
I’ve followed this thread through and through and it’s still not working.

I am trying to get this to work as well and no matter what I tried from all these article threads nothing is working. It would be great if someone who has gotten this to work can provide complete instructions from beginning to end on how to set this up. There is a lot of conflicting information in this forum on how this should be done.

Hi, thanks for your reply. Sadly, removing the semi-colon didn’t change anything.

Badge

HI Johannes,

Here’s how I’m doing it on my page. Your code looks the same as mine, EXCEPT you have a semi-colon after the curly brace in the 2nd to last line… I’m no code expert, but could that be causing a problem?

My drop-down selections are as follows:

Who are you providing care for? (field is p_relation)

  • myself

  • spouse

  • parent

  • other

Depending on what they choose i send them to 2 different pages. JS below…

–Kirsti

Here’s my JS: https://paste.ofcode.org/bKkgmpZD4PS3g8eVtHfegJ

Hi everybody,

As others I am trying to redirect the user based on on the option they used in a drop down menu.

However, it’s not working, it always redirects to the fallback url.

I’ve used the following options

Custom drop down menu

Name & Id is “test”

first menu choice is “taz”

second menu choicen is “zeit”

Form Confirmation is “Go to URL”

URL is “https://www.spiegel.de

Target “Same tab or window”

Append form data to url is unchecked

This is the code I have in the javascipt window:

https://paste.ofcode.org/33sbrUU4Ekb22nqt8kqJUNS

It’s not working… i follow the instruction too…

Userlevel 5

Looks like your script has a typo and the console says it’s not a function.

Try pasting this into your Unbounce page…

<script>
$("#optin1").live('change', function() {
switch ($(this).val()) {
case 'Yes':
window.module.lp.form.data.url = "https://fwytrk.com/d.ashx?ckm_campaign_id=188&ckm_key=LG9TsxmdK98&ckm_bp=1";
break;
case 'No':
window.module.lp.form.data.url = "https://fwytrk.com/d.ashx?ckm_campaign_id=136&ckm_key=LG9TsxmdK98&ckm_bp=1";
break;
};
});

I hope that works. Otherwise, I dunno 🤷

http://woodgroupmortgage.com/buy-a-home-waco/

Userlevel 5

Hey James, could you share the link to the page this is running on?

It would be helpful to take a look. Thanks!

I am using the adjusted script but it still isn’t working. Below is my script:

$("#optin1").live(‘change’, function() {

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

case 'Yes':
    window.module.lp.form.data.url = "https://URL1.com";
    break;
case 'No':
    window.module.lp.form.data.url = "https://URL2.com";
    break;

}

});

It just keeps sending me to the deafult URL set in the “Properties” section of the builder.

Userlevel 7
Badge +3

Hey @Brett_Rosenblatt,

You need to adjust your script. Take a look one post above you for an example of what you need to change (confirmData to url).

Best,
Hristian

Badge

Can somebody please help me. I am using a script that I have used perfectly in the past but for some reason, I can not get it to work on this page. I am trying to send users to one url if the select “Yes” in the drop down and to another if the select “No” in the dropdown. Here is the scrip I am using: (I have it set to Before End Body Tag"


$("#business_bank_account").live(‘change’, function() {

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

case 'Yes':
    window.module.lp.form.data.confirmData = "https://approvals.xxxxxxx.com/business-funding-thank-you/";
    break;
case 'No':
    window.module.lp.form.data.confirmData = "https://approvals.xxxxxxx.com/business-funding-thank-you2/";
    break;

}

});

</script>


For some reason the page is ignoring the script. The field name is correct and I have it set to “go to URL” and append is checked. There is a fallback url set as well and that is always where it is taking the user. Please help

Userlevel 5

I have seen a few other inquiries about using this script recently. So I figured I should post the update that works in this thread. Special thanks to @Hristian for making it work!

<script>
$("#gender").live('change', function() {
switch ($(this).val()) {
case 'Male':
    window.module.lp.form.data.url = "http://www.google.com";
    break;
case 'Female':
    window.module.lp.form.data.url = "http://www.bing.com";
    break;
};
});
</script>
Badge

I got this same script from Unbounce tech support, but it doesn’t seem to be working.

I’m testing on this page: https://my.caredetective.com/landing-page-test-area/

I’ve set the form confirmation to “Go to URL” and have it pointed to: https://my.caredetective.com/upsell-test/

And the JS code I added looks like this (I’m no coder, just to be clear):

image

However, at this point “Self” is not going anywhere different. Any thoughts? :-/

Userlevel 5

Eliot,

Here is a script that an Unbounce team member had put together. You should be able to edit your field names and get along just fine if you are comfortable with a little javascript editing.

Reply