Hi. I have some code that i want to work with a dropdown every time I change the dropdown
It seems to skip over the first part of the code even though everything may be true
Im using this code to show and hide an English Video player and an Afrikaans video player. The dropdown values are AR and EN
Heres the code I used:
export function updateLang_click(event) {
let item = $w("#dynamicDataset").getCurrentItem();
if ((item.ar) && (lang == "AR")) {
$w("#en").collapse();
$w("#ar").expand();
} else if ((item.en) && (lang == "EN")) {{
$w("#en").expand();
$w("#ar").collapse();
}
}
}
This is the best method for doing what you are attemping to do, but you need to change your videoplayer id as such:
Step 1: Change Video Player names in this fashion:
name your English videoplayer “#enplayer” and your Afrikaans video player “arplayer”, and all your other video players in such manner.
Step 2: Go to your dropdown and add an “onChange()” function.
Step 3: Add this code to your onChange() function.
export function languagedropdown_change(event) {
//Hide all of your video players:
$w("#enplayer").hide();
$w("#arplayer").hide();
//.... repeat this for all video players.
//Gets the Language from the Drop Down List.
let language = $w("#languagedropdown").value;
//Creates an id for the language chosen.
let showplayer = "#" + language + "player";
$w(showplayer).show();
}
IMPORTANT: This code assumes your drop down box is called “#languagedropdown”, and the values of the drop down list are the abbreviation of the language: (ex: en, ar…etc).