All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Hiding filter option if option will have no results

ad 4 Jan 2015 22:21 question, complete

Hi there,

Is there any way to add a class to filter options that don't have results? I'm trying to have them be hidden in a form.

For example, I have a form that doesn't use encoded queries with multiple dropdowns that submit onchange. One dropdown is person_country and another is person_state. When I select Canada for person_country, the page refreshes and my search results are limited to folks from Canada. But my person_state dropdown still shows options with states from USA despite the fact that none of the entries in the search results have a USA state in the person_state field.

Thanks!
AD

Replies

  1. Low 5 Jan 2015 10:23

    I'm afraid that search filters are not results-aware.

    This is mainly due to limitations in EE's entries API, where, given a set of both native and 3rd party filters, it's not possible to programmatically retrieve all entry IDs for those filters.

    Right now, you can only hide/show filters based on the values of other filters.

  2. ad 5 Jan 2015 10:25

    Got it and thanks for the response.