Multiple dropdown selection takes you to multiple URLs


#1

Hello!

I was able to make a single dropdown menu go to a specific URL using this code:

But I have multiple (4 total) dropdowns, and depending on the combination of the selections, I want to set it to go to a different URL. So if the 4 dropdowns were city, food, price, month, then Boston+Burger+$20+March selection would take you to a different URL from Chicago+Ham+$5+June selection.

Any help would be much appreciated.


#2

Hi Wed,

Unfortunately you cannot easily use logical operators in a case statement (which makes it difficult to use AND) so you cant evaluate multiple drop downs from your case statement using a combination of the variables. You have two options…

  1. Use If, Else If and Else statements so that you can evaluate multiple values at the same time using AND (&&) . This will be the shortest and most efficient way for you. 

  2. Setup a separate variable that holds the value for the case statement, so you would use a combination of IF to set the variable then the case statement to choose which block of code to run, It seems a longer way around but it does have the benefit of being easy to follow in terms of code blocks that are all together. 

Hope that gives you a bit of a heads up as to which direction to take. 

Cheers

Stuart.