HI
can someone help me get rid of this error please im stuck. i have exact same code running above it for another drop down which is a text return and it works fine so i assume its a number vs string issue somewhere?
Wix code SDK error: The label parameter of item at index 0 that is passed to the options method cannot be set to the value 2. It must be of type string.
Front end code is like this
$w.onReady( async function () {
// This function calls the back end unique drop down creator
$w(“#food1Dropdown”).options = await populateDropdownfoodnamevalues(“MyFoods”,“foodType”);
$w(“#qty1Dropdown”).options = await populateDropdownquantitys(“Quantity”,“quantity”);
});
//Backend module as follows:
import wixData from ‘wix-data’;
export function populateDropdownquantitys(collectionName,valueField) {
let allItems = ;
return wixData.query(collectionName)
.ascending(“quantity”)
.find()
.then((results) => {
if (results.totalCount > 0) {
let items = results.items;
items.forEach((item) => {
let oneItem = {
label: item.quantity,
value: item[valueField].value
}
allItems.push(oneItem);
})
return allItems;
}
return null ;
})
}