I currently have a list of Taxonomy terms: Fruit, Meat, Vegetables..etc. And I would like to add a drop down to a content type that will display all nodes and only the nodes that are associated to a Taxonomy Term. I am currently using the Node Reference- Select List, but the list is growing and will eventually become unmanageable.

To Summarize: In example, I select a Taxonomy term and then a "select list" displays only nodes that have been previously associated to that same Taxonomy term. I select Fruit and it displays oranges, apples, and lemon nodes only. Not... lemons, oranges, carrots, ribeyes...etc, in which, is my ever growing Node reference list now.

Thank you for any help you may lend.

1 Answer 1


You could accomplish this by writing code (in a custom module) to ajaxify the relevant select fields. Check out the Examples module (ajax examples -> dependent dropdown) for implementation help. Here's what needs to be done roughly:

  1. Use hook_form_alter or hook_form_FORM_ID_alter to add necessary #ajax options (callback and wrapper at minimum) to the taxonomy select field. The node reference field needs a wrapper (via #prefix, #suffix) and #options changed when a term has been selected (value set in $form_state['values']).
  2. A function for the ajax callback returning the node reference form field.
  3. Custom functionality checking which nodes are associated with the selected term to set the right options for node reference. Easiest way might be by querying them directly from the taxonomy_index database table (if you need other data (like type) include the node table as well).

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.