Filtering of 2 consecutive dropdowns

In another post, Jeff mentioned :

QUOTE
BTW- I noticed that your first name dropdown isn’t filtering based on the last name selection. Your firstnamebox_change function needs to look like this:export function

firstnamebox_change() { let firstName = $w(‘#firstnamebox’).value; $w(‘#registrationsdataset2’).setFilter(wixData.filter()
.eq(‘firstName’, firstName)
.eq(‘title’,$w(“#lastnamebox”).value) );
$w(“#tableofevents”).show(); }
UNQUOTE

My original code is:

export function lastnamebox_change (event) {
$w(“#tableofevents”).hide();
//First Name to be automatically filled-in depending on Last Name selected
let lastName = event.target.value;
$w(‘#registrationsdataset2’).setFilter(wixData.filter().eq(‘title’,lastName));
}
export function firstnamebox_change() {
//Once First Name is selected, table with all events appear
let firstName = $w(‘#firstnamebox’).value;
$w(‘#registrationsdataset2’).setFilter(wixData.filter().eq(‘firstName’, firstName));
$w(“#tableofevents”).show();
}

Jeff, from the best of my tests, my code works fine (except as per my other post, when I remove duplicates of last names and deselect ‘Connect dropdown list items’). I actually have a slightly simpler situation into another page (www.shanghai-gc.com/who-is-registered2) since the first dropdown is already referenced with all 12 months of the year. Code as per below.


Same as before, my code gives the proper results but my second dropdown (dateofevent) is frozen after the first request. If I deselect the ‘Connect dropdown list items’, then I do not have any values in the dropdown.

Can you kindly have a look and let me know how to solve this.

Thanks a lot

Hi there,

You can use an ’ or ’ condition in your filtering object.

Liran.