Skip to content

Instantly share code, notes, and snippets.

@johnnyopao
Last active December 15, 2022 11:42
Show Gist options
  • Save johnnyopao/95fded8878592981b969 to your computer and use it in GitHub Desktop.
Save johnnyopao/95fded8878592981b969 to your computer and use it in GitHub Desktop.
Change form destination URL by dropdown selection on Unbounce
  1. Be sure to first change your forms confirmation to 'Goto another webpage' and set a default fallback URL

  2. Drop this script into your javascript box. Set the placement to 'before body end tag'

<script>

$("#gender").live('change', function() {
 
  switch ($(this).val()) {
      
    case 'Male':
        window.module.lp.form.data.confirmData = "http://www.google.com";
        break;
    case 'Female':
        window.module.lp.form.data.confirmData = "http://www.bing.com";
        break;
  }
  
});
  
</script>
  1. Replace 'gender' with the ID of your dropdown field.

  2. Modify or add as many different 'cases' as you need

@JFB-Jenkins
Copy link

FYI Unbounce seemed to have changed their object structure, this now needs to be:
window.module.lp.form.data.url = "http://www.google.com";

@ma3achou
Copy link

JFB ! nice move.

@OppNDesign
Copy link

Hi! I used that script but it's still not working in my landing page. D o you know if it's the right one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment