Displaying images in a gallery based on user selection from a dropdown list

Please Help!
I have spent two days trying to solve this problem and I’m sure it’s going to be something simple in the end but right now I need to get it done so any help would be appreciated.

I have created a page like the recipe example in your tutorial but mine contains a dropdown list and a gallery. The dropdown list is now working and displaying the list from one dataset (members) but the gallery will not display anything at all. I have filtered the second dataset (images) with the field from the main dataset which populates the dropdown list. I have even used reference fields to connect the two databases and I have synced the databases. Neither in preview or published modes will the gallery display anything. Any ideas?

Hi, can you please share your site?

Sorry, but it’s not live yet but this is the code I’ve been trying based on tutorials I hve followed:
$w.onReady(function () {
});

export function memberDropdown_change(event, $w) {
$w(" #memberimagesdataset “).setFilter(wixData.filter()
.eq(” #memberName “, $w(” #memberDropdown “).value));
$w(” #repeater1 ").show();
}

then I tried this:
import wixData from ‘wix-data’;

$w.onReady(function () {
$w(’ #memberimagesdataset ').onReady(function () {
searchMembers();
});
});

export function memberDropdown_change() {
searchMembers();
}

function searchMembers() {
wixData.query(‘MemberImages’).eq(‘memberName’, $w(" #memberDropdown ").value)
.find()
.then(res => {
$w(’ #repeater1 ‘).data = res.items;
$w(’#repeater1’).show
});
}

Hope you can help. Thanks.

In your first solution, looks like there’s a typo and the equality condition should use “memberName” instead of " # memberName".
If that doesn’t work, we need the full context to understand better. You can post your editor URL even if your site is not live yet, only Wix Support can open it.

Hi Tomer. Thanks for looking at this for me. I’m afraid I’ve gone right back to the drawing board and I’m testing this out step by step. I wonder if you could help me understand what I’m doing please. This is a test page with a dropdown list populated from the Members db. In preview the dropdown list appears to work but when I try to place the selected item into a variable and view it all I get is Array[0]. So… I’m thinking that this is the first step to correct - what should I do?


This is the database:


Thanks for your help.

Remove the $w wrapping selectedMem and newMem.
$w is used to select elements, you don’t need it here.