Whenever I am doing conditional dropdown as explained by CodeQueen ,after the selection in the first dropdown the second dropdown is not getting enabled.
The sample code is below
import wixData from 'wix-data'; $w.onReady(function () { uniqueDropDown1(); }); function uniqueDropDown1 (){ wixData.query("ifsc") .limit(1000) .find() .then(results => { const uniqueTitles = getUniqueTitles(results.items); $w("#dropdownName1").options = buildOptions(uniqueTitles); }); function getUniqueTitles(items) { const titlesOnly = items.map(item => item.state); return [...new Set(titlesOnly)]; } function buildOptions(uniqueList) { return uniqueList.map(curr => { return {label:curr, value:curr}; }); } } export function dropdownName2_change(event) { //Add your code for this event here: uniqueDropDown2(); $w("#dropdownName").enable(); } function uniqueDropDown2 (){ wixData.query("ifsc") .contains("state", $w("#dropdownName1").value) .limit(1000) .find() .then(results => { const uniqueTitles = getUniqueTitles(results.items); $w("#dropdownName").options = buildOptions(uniqueTitles); }); function getUniqueTitles(items) { const titlesOnly = items.map(item => item.city); return [...new Set(titlesOnly)]; } function buildOptions(uniqueList) { return uniqueList.map(curr => { return {label:curr, value:curr}; }); } } Here dropdownName is not getting enabled.
Thanks
So you are using Nayeli (Code Queen) tutorial as shown here.
Conditional Filtering for Dropdowns on Wix | Corvid Tutorial
https://codequeen.wixsite.com/dropdown
https://codequeen.wixsite.com/dropdown/code
The first question would be is your second dropdown called #dropdownName as you have the three of #dropdownName and #dropdownName1 and #dropdownName2 all used in your code when you are only using the two dropdown elements.
Especially where you have the onChange event on #dropdownName2 when I am pretty sure that it should be for the first dropdown used in this process.
Also, double check your code against hers on the tutorial and watch her YouTube video too, so that she can walk you through it all.
There is also this Wix Corvid example for dropdowns too.
https://www.wix.com/corvid/example/cascading-form