4

I'm trying to build a content type that has two selectlist fields. My problem is that the first field should filter the second field options

For example:

First field options (This field must filter the next field options):

-Red (Selected)

-Blue

-Green

Second field options would be:

-Apple

-Strawberry

-Cherry

0

Sounds like you need the Hierarchical Select module. Here is a quote about it (from the module's project page):

... 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!

1

Take a look at Conditional Fields module to define dependencies between fields based on their states and values. Conditional Fields allows you to manage sets of dependencies between fields. When a field is “dependent”, it will only be available for editing and displayed if the state of the “dependee” field matches the right condition. When editing a node (or any other entity type that supports fields, like users, terms and files), the dependent fields are dynamically modified with the States API.

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.