Database search form

Hi, I ve set up a dropdown button to filter my database by category, and if I connect its value to a database field, it turns inactive and I unable to click it.
Here is my code:

import wixData from ‘wix-data’;

export function input1_keyPress(event) {
//Add your code for this event here:
let SearchValue = $w(“#input1”).value;
$w(“#dataset1”).setFilter(wixData.filter().startsWith(“title”, SearchValue));
}

export function dropdown_change(event) {
let searchCategory = $w(“#dropdown”).value;
$w(“#dataset1”).setFilter(wixData.filter().contains(“category”, searchCategory));
//Add your code for this event here:
}

My screenshots are below.

Could any one tell me where the bug is? I would be very grateful to receive any suggestion.
Best regards,
Daria

Hey, if you connect a dropdown to a value you are connecting it’s value to that dataset and won’t be able to select. You should instead connect it to a list and choose which Data Collection to connect it to or add items manually but do not connect it’s value to a dataset when you want to use it as filter.

1 Like


I ve done it this way and ended up with this… My data base is and excel sheet looking exactly like this table with 5 columns…

Please, please help me, wix guru…
Regards

@op1 Ok so you have multiple records that holds the same values as in “Travel” I guess then. One way is to make sure only unique records are shown in the Dropdown, another way is to create a Data Collection where you enter what you want in your Dropdown. If you want to show only unique records in the dropdown there is plenty of samples here in the forum, just make a search show unique values in dropdown and you will get a lot of working samples.