Can I use multiple 'ORs' (||) with the onEvent block


#1

I have a student who wrote:
onEvent(“back1” || “back2” || “back3” || “back4” || “back5” || “back6” || “back7” || “back8” || “back9” || “back10” || “back11” || “back12”, “click”, function(event) {
setScreen(“MainScreen”);
});
Clicking on the first back button goes back to the main screen. The others do not work.


#2

No! Each button must have its own OnEvent block. This onEvent is only for “back1” and will get triggered when “back1” is clicked. All the other conditions in the OR are ignored.


#3

Thanks for your quick response!