3

I have a View that I am using to allow users to search for nodes on my site, all nodes have a category and a subcategory. I have two filters in the View, call these Parent Term filter & Child Term filter.

Example vocabulary:

-Categories
--Category A
---Item 1
---Item 2
---Item 3
--Category B
---Item 1
---Item 2
---Item 3

I want to implement the following functionality:

  1. User selects Category A from list in Parent Term filter.
  2. Child Term filter list populates with only Category A child terms.
  3. User selects Category B from list in Parent Term filter.
  4. Child Term filter list populates with only Category B child terms.

I've looked into Views Dependent modules, but none seem to do this properly. I'd prefer to have something in code (AJAX?) that does this much more efficiently.

At the moment I have the two filters manually limited to parent terms and child terms. However this means the child term filter shows all children irrespective of parent term selected.

1

I would take a look at Simple Hierarchical Select. From the module page:

Simple hierarchical select defines a new form widget for taxonomy fields to select a term by "browsing" through the vocabularies hierarchy. The widget is available in node forms and as Views exposed filter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.