I already have to code, but I was wondering if someone knew how to set up a search feature on my website. I have 2 dropdown menus…1 for State/Province…the 2nd for City/Area. I just need to know how to set up that search feature in my database.
Hello mrobin
Have a look at his. You will need to replace the values in bold to the names in your site.
import {wixData} from ‘wix-data’;
export function button1 _click(event, $w) {
$w(“# dataset1 “).setFilter(wixData.filter()
.contains(” state “, $w('# dropdown1 ').value) .contains(” city “, $w('# dropdown2 ').value))
.then(() => {
console.log(“Dataset is now filtered”);
$w(”#repeater1”).data = results.items;
}).catch((err) => {
console.log(err);
});
}
Hello!
You can also check this example: https://www.wix.com/code/home/example/Cascading-Form
I believe it does what you want
Mr Tiaan
Have a look at his. You will need to replace the values in bold to the names in your site.
import {wixData} from ‘wix-data’;
export function button1 _click(event, $w) {
$w(" # dataset1 “).setFilter(wixData.filter()
.contains(” state “, $w(’ # dropdown1 ').value) .contains(” city “, $w(’ # dropdown2 ').value))
.then(() => {
console.log(“Dataset is now filtered”);
$w(” #repeater1 ").data = results.items;
}).catch((err) => {
console.log(err);
});
}
0
Can you make a video tutorial for step by step where to upload it in wix? do I need to make a database for the country and city?
I learnt it. I realize it’s wrong!
In wix is just supported by this code to create a list of options:
$w(“#myDropdown”).options = [ {“label”: “Who’s on first!”, “value”: “first”}, {“label”: “What’s on second”, “value”: “second”}, {“label”: “I Don’t Know is on third”, “value”: “third”} ];
BUT:
the code in cascading form said:
$w(“#myDropdown”).options = field
This is not supported! Then, It annouced that " your dropdown cannot set to be null or unndefined." Becuz it was not the form wix supported