I’m trying to redirect a user to a different page after submitting a form based on their selection from a dropdown:
My dropdown is countries, and based on what country the user select, I want him to be redirected to that country-specific page, for example, if the user selects Canada from the dropdown, he should be redirected to mywesbite.com/country/canada note that country is a CMS collection.
My form ID is wf-form and my dropdown field ID is country
Thanks, I guess that’s too complicated for me, there was an answer to a similar problem in this post and I am hoping to get the custom code for my case similar issue
Hi, can’t get this to work. My code looks like this:
<script>
$('#culture-guide-form').submit(function() {
const selectedValue = $('#company-size').val();
switch (selectedValue) {
case '1 to 99':
window.location = "/page-1"
break;
case '100 to 249':
window.location = "/page-2"
break;
default:
window.location = "/page-3"
}
});
</script>
Tried having this inside and outside of the form but it’s not working. I also removed the redirect URL from the form element. I just see the thank you message when the form is submitted.