1

I am working on a system where we want users to be able to create a Project which will be made up of one or more Project Activities, each Project Activity being constituted of several Sub-Activities.

Each Project Activity can be one of several types, and the Sub-Activities also are typed. This means that when I assign a Project Activity to a Project, I should only assign Sub-Activities of the same corresponding type.

So, I have two fields in the Project content type, one is Project Activity, the other is Sub-Activity (which can have multiple values). Both these fields are Entity References to the corresponding Project Activity and Sub-Activity content types. What I want then, is when I enter the Project and choose Project Activity type A, I should only be able to select Sub-Activities of type A also.

I had thought to do this using the Views selection with a contextual filter, however this only seems to work with a static filter when mine needs to be dynamic.

Does anyone know a way round this, or a different approach which could solve the problem?

1 Answer 1

1

I've not used it yet myself. But, if you want an out of the box solution you can try the Hierarchial Select module:

This module defines the "hierarchical_select" form element, which is a greatly enhanced way for letting the user select items in a hierarchy.

Hierarchical Select has the ability to save the entire lineage of a selection or only the "deepest" selection. You can configure it to force the user to make a selection as deep as possible in the tree, or allow the user to select an item anywhere in the tree. Levels can be labeled, you can configure limit the number of items that can be selected, configure a title for the dropbox, choose a site-wide animation delay, and so on. You can even create new items and levels through Hierarchical Select!

See the project page for a Demo page.

Depending on how complex your criteria is you could also consider the #states Form API of Drupal 7, or a simple jquery Ajax callback on your select tags in the form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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