![](https://static.wixstatic.com/media/a27d24_aaab66cb03e344cfbe426aad7367afa5~mv2.jpg/v1/fill/w_925,h_118,al_c,q_80,enc_auto/a27d24_aaab66cb03e344cfbe426aad7367afa5~mv2.jpg)
![](https://static.wixstatic.com/media/a27d24_f496d73abb6b4b688c15a986e5477346~mv2.jpg/v1/fill/w_549,h_419,al_c,q_80,enc_auto/a27d24_f496d73abb6b4b688c15a986e5477346~mv2.jpg)
How do i filter the select subject dropdown based on the academic level. I have created the collection but i have no idea how do i link them.
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
OK I'm an idiot, it was just my stupid code, now I see I had the line let opts = $w("#ddlPages").options; so although the dropdown WAS no doubt being cleared I was then pushing the new items onto the old items in the array and putting the whole lot back into the dropdown - doh!
For anyone who's interested and would also like to know, I found the answer to my problem. If I put the emptyArray declaration and assign it to the Pages dropdown in the Change event of the Areas dropdown, it clears the options out of the Pages dropdown (and then of course in the same Change event I call the function to fill the Pages dropdown with the code in my original comment above. Still not sure why it didn't work if in the original place, but oh well...
This is a joke. If you follow that link and open the "example" in the editor, it doesn't work (at least not for me!), regardless of which country is picked the State dropdown shows three options, "SELECT STATE", "BABY" and "CHILD". Not much help...
In case the original poster is still looking for an answer, here's how I do it (but I have one thing I can't work out, which I'll explain after the code:
wixData.query("WebsitePages").ascending("page") .eq("areaRef", $w("#ddlAreas").value) .find() .then(results => { results.items.sort(); let opts = $w("#ddlPages").options; var emptyArray = []; $w("#ddlPages").options = emptyArray; for (let i = 0; i < results.items.length; i++) { opts.push({"label": results.items[i].page, "value": results.items[i]._id.toString()}); } $w("#ddlPages").options = opts; });
I have two dropdowns "Areas" (of the website) and "Pages" (each page belongs to a single area. When the user selects an area, I want to fill the Pages dropdown with the appropriate pages. THE PROBLEM I have is if the user changes his/her mind and wants to select a new area; in this case I would need to delete all the (now inappropriate) options from the Pages dropdown and re-fill it with the pages that are appropriate for the newly selected area. According to the Wix documentation you can remove all options from a dropdown by setting the options to an empty array, and you can see me doing this with the emptyArray prior to iterating through the collection and creating the actual dropdown options. BUT the options are NOT being removed. ALSO if, just to test it, I put those two lines of code (the emptyArray declaration and assignment to the dropdown options) somewhere else (say in a button click) and run it the options ARE removed from the dropdown, so the two lines work in isolation. Any ideas?
Already shown in this forum's own examples.
https://www.wix.com/corvid/example/cascading-form