Forum
User filterable list
Hi,
I've got a user filterable list set up to filter jobs based on text found in the job title and a location <select>.
In the location <select> there are several locations - North West, South East, etc. There's also an All Areas option which when selected should just display all the jobs.
I can't figure out the best way of doing this? Obviously 'All areas' isn't a value in a field and as such isn't marked against any jobs.
Any help or pointers would be really helpful.
Many thanks,
John.
I'd make the option empty or a known value like 'all'. If that value is set, don't apply the filter.
Thanks Drew,
Can I be cheeky and ask for some code pointers?
This what I've got so far, I'm mindful that I can't completely turn the filter off because the text search still needs to work on 'all' locations.
Hope that makes sense and thanks.
You'd just change:
to something like
Works a treat!
Many, many thanks Drew.
Sorry to bother you again Drew, just one other small thing.
If I enter say a partial word into the text field, like "grad" instead of "graduate" it doesn't return a result, even though it's set up with 'contains'.
Is this normal behaviour or have I done something wrong?
A 'contains' filter matches against word boundaries. It won't find a partial word.
Ok, thanks Drew.
Hi Drew,
Is it possible to set one filter against two fields so that one text input could search both?
Something like this perhaps:
I've tried putting them in as separate filters but they seem to cancel each other out.
See the section "Filtering by multiple fields" here: https://docs.grabaperch.com/docs/content/perch-content-custom/
Thanks