Hi all,
I’m trying to develop a little feature whereby selecting an option in a drop down list will update the text in a text box.
The idea is that the item in the drop down is retrieved from wix data, let’s say the items are 1,2,3,4, and that each item has a corresponding bit of text also stored in wix data that will display in the text box based on the selection, let’s say 1=100, 2=200, 3=300, 4=400…
I’ve got the first part of this working (below).
Any help on how to get the second part working?
Many thanks !
import wixData from ‘wix-data’;
$w.onReady(function () {
dropdown();
});
function dropdown () {
wixData.query(“licenseCost”)
.limit(1000)
.find()
.then(results => {
const size = getSize(results.items);
$w(“#sizeSelector”).options = buildOptions(size);
});
function getSize(items){
const titlesOnly = items.map(item => item.councilSize)
return […new Set(titlesOnly)];
}
function buildOptions(uniqueList){
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}