I am trying to populate a form drop down element from information added by a user into another data collection.
The code I have is as follows -
import wixData from 'wix-data';
$w.onReady(()=>{
wixData.query('EventsDatabase')
.find()
.then(res => {
let options = [{"value": '','label': 'eventName'}];
options.push(...res.items.map(eventname => {
return{'value':eventname.title,'label': eventname.title};
}));
$w("#dropdown1").options = options;
})
});
The data collection = EventsDatabase
The field from the data collection to populate the drop down = eventName
The dropdown element in the form that I want to populate = #dropdown1
I am getting the above message and the dropdown is only showing the field title and not the dropdown options.