Can I get help figuring out why the code below is generating a drop down text selection error?
onEvent(“dropdown_week”, “change”, function(event) {
if (getText(“dropdown_week”) == “Monday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Tuesday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Wednesday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Thursday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Friday”) {
setText(“msg_label”, “It’s a weekday. Go to school.”);
} else {
if (getText(“dropdown_week”) == “Saturday”) {
setText(“msg_label”, “It’s the weekend! Stay home!”);
} else {
if (getText(“dropdown_week”) == “Sunday”) {
setText(“msg_label”, “It’s the weekend! Stay home!”);
}
}
}
}
}
}
}
});
Congrats on your first post, Christine! On thing of note, when I copy and past your code app lab is unhappy with your double-quotes. There is more than one ASCII character for double-quotes and app-lab only plays nice with the right one.
Bad double-quotes (notice how they are different for the beginning and end of dropdown_week):
onEvent(“dropdown_week”, “change”, function(event) {
if (getText(“dropdown_week”) == “Monday”)
Good double-quotes:
onEvent(“dropdown_week”, “change”, function(event) {
if (getText(“dropdown_week”) == “Monday”)
Hi James,
Can you please clarify for me? when I look at what you showed under the bad double quotes and the good double quotes examples, they are identical. I do not see how they are different.
I just noticed that the forum (or my browser) automagically converts the quotes to curly… Sorry for that rabbit hole of sorts, I’ve just had code that looked correct but didn’t work.