So I have this page set-up where people can type in their town, city etc and filter the results of a big events list to find results in there city. That all works great.
https://www.virtueforanimals.org/getactive
People can submit events to the database and in the database itself we have an ‘approve’ field which we can tick to allow that event to show up once we have checked it over.
We have a filter set so it only shows events that have ‘approve’ ticked but are finding that when we search for something the search results ignore that filter and will show unapproved events.
What we need is a way to have all search results only show events that have ‘approve’ ticked.
This is the code I have for the search. Any help would be amazing.
Please note : I’m very new to wix coding so if you can keep the answer quite simple that would be great Thank you x
import wixData from “wix-data”;
export function iTitle_keyPress(event, $w) {
filter($w(‘#iTitle’).value);
}
function filter(title) {
const filterValue = $w(“#iTitle”).value
const byTitle = wixData.filter().contains(“title”, filterValue)
const byCity = wixData.filter().contains(“city”, filterValue)
const byCounty = wixData.filter().contains(“countyState”, filterValue)
const byCountry = wixData.filter().contains(“country”, filterValue)
const byApprove = wixData.filter().contains(“approve”, filterValue)
$w(“#dataset1”).setFilter(byTitle.or(byCity).or(byCounty).or(byCountry))
}