


Hi All.
I have huge drop down list with some items finish on same content. For instance,
AAA - 4 weeks
BBB - 2 weeks
CCC - 3 weeks
DDD - 4 weeks
EEE - 2 weeks
FFF - 4 weeks
GGG - 2 weeks
and so on.
is it possible specify wildcard in IF statement? What I mean.
if (dropdown1.rawValue == %4 weeks) {
Textbox1.presence = "invisible";
}
else if (dropdown1.rawValue == %3 weeks) {
Textbox2.presence = "invisible";
}
else if (dropdown1.rawValue == %2 weeks) {
Textbox3.presence = "invisible";
}
Thanks.
Views
Replies
Sign in to like this content
Total Likes
Hi,
I dont know about using wild cards, but what you have shown as an example would work well using a switch.
switch(dropdown1.rawValue)
{
case "1 Week":
Textbox1.presence = "invisible";
break;
case "2 Weeks":
Textbox2.presence = "invisible";
break;
default:
//you can enter a command if you wish to execute if none of the other conditions are met. This is kind of like an 'else'
break;
}
You need to have default at the end. The switch works by looking at the value in the brackets and uses the value to find the 'case' and execute the commands. It is basically a much tidier if statement.
Views
Replies
Sign in to like this content
Total Likes
You can use the string match (see below).
var str = "4 Weeks";
var res = str.match(/4 weeks/g);
This would make it more complex. Another way would be to use the || opperator
if(this.rawValue == "AAA - 4 weeks" || this.rawValue == "DDD - 4 weeks"){
do something...
Views
Replies
Sign in to like this content
Total Likes