Hey there,
I want to populate dropdown menus with reference fields from a collection. My code for this:
$w.onReady(function () {
$w('#gegner').onReady( () => {
const gegner = $w('#gegner').getCurrentItem();
$w('#wechselData').onReady( () => {
const wechselJSON = JSON.stringify(gegner.wechselIndikator);
const wechsel = wechselJSON.slice(8, wechselJSON.length-2);
const wechselOptions = $w('#wechselIndikator').options;
let index = 0;
wechselOptions.forEach((option) => {
if (wechsel === option.value) {
$w('#wechselIndikator').selectedIndex = index;
}
index++;
});
});
});
});
Is this the only way to read JSON values? (it does work like this)