I keep getting this error in my code and I have no idea what is wrong with it. I am making 3 dropdown menus that filter between each one. Help please!
Error message: Wix code SDK Warning: The selectOption parameter at index 13 that is passed to the options function cannot be set to [object Object]. Options must contain either a non-null value or a non-null label.
import wixData from ‘wix-data’ ;
$w.onReady( function () {
uniqueDropDown1();
});
function uniqueDropDown1 (){
wixData.query( "countiesList" )
.limit( 1000 )
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w( "#dropdown1" ).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.county);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
export function genre_change(event, $w) {
uniqueDropDown2();
$w( “#dropdown2” ).enable();
}
function uniqueDropDown2 (){
wixData.query( "countiesList" )
.contains( "county" , $w( "#dropdown1" ).value)
.limit( 1000 )
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w( "#dropdown2" ).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.subCounty);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
export function subcategory_change(event, $w) {
uniqueDropDown3();
$w( “#dropdown3” ).enable();
}
function uniqueDropDown3 (){
wixData.query( "countiesList" )
.contains( "subCounty" , $w( "#dropdown2" ).value)
.limit( 1000 )
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w( "#dropdown3" ).options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.ward);
return [… new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}