Last updated September 15, 2010. Created on November 7, 2009.
Edited by corbacho, jrao, MyXelf. Log in to edit this page.


The module Hierarchical Select Node Reference allows the use of Hierarchical Select form element as a widget for CCK node reference field, both in node add/edit forms and in Views filters.

Installation & Configuration

Please read README.txt for detailed installation instructions, explanation of concepts, configuration tips and example setup. The examples below demonstrated what this module can do, but for detailed instructions on how to use this module, please refer to the README.txt.


Content Types

The example uses the following content types:

  1. Country
    • Name
  2. State
    • Name
    • Country: Content types = Country, Required, Number of values = 1
  3. City
    • Name
    • State: Content types = State, Required, Number of values = 1
  4. Address
    • Street
    • City: Content types = City, Required, Number of values = 1
  5. Customer
    • Name
    • Addresses: Content types = Address, Required, Number of values = 5
  6. Order
    • ShippingAddress: Content types = Address, Required, Number of values = 1
    • Customer: Content types = Customer, Required, Number of values = 1
    • TaxZone: Content types = TaxZone, Required, Number of values = 1
  7. LineItem
    • Order: Content types = Order, Required, Number of values = 1
    • Product: Content types = Product, Required, Number of values = 1
    • Amount
  8. Product
    • Name
    • MadeBy: Content types = State or Country, Optional, Number of values = 1
    • Warehouse: Content types = Address, Required, Number of values = 1
  9. TaxZone
    • Tax
    • Zone: Content types = Address or City or State or Country, Required, Number of values = 10

Node reference paths

Given the content types listed above, the following node reference paths are possible:

  1. LineItem.Order-Order.ShippingAddress-Address.City-City.State: Number of values = 1 and single content types at all levels
  2. Customer.Addresses-Address.City-City.State: Number of values > 1 at root
    • This is used to test dropbox in node reference field widget
  3. TaxZone.Zone-City.State-State.Country: Number of values > 1 & multiple content types at root
    • This is used to test save lineage in node reference field widget
  4. Product.MadeBy-State.Country: Number of values = 1 & multiple content types at root
  5. Order.Customer-Customer.Addresses-Address.City-City.State: Number of values > 1 at non-root
  6. Order.TaxZone-TaxZone.Zone-City.State-State.Country: Number of values > 1 & multiple content types at non-root
    • When using this path as node reference field widget, it can only select tax zones containing a city
    • Similarly when using this path as views filter, it can only filter zones containing a city
    • Current implementation can only select an item from the last level in the path, future enhancement is needed to allow selection from middle levels
  7. LineItem.Product-Product.MadeBy-State.Country: Number of values = 1 & multiple content types at non-root
    • Similar to #6, when using this path as field widget/views filter, it can only select/filter products made by a state (not by country)

Usage Screenshots

CCK Node Reference Field

  1. See for a screenshot of the field setting for path "Order.TaxZone-TaxZone.Zone-City.State-State.Country". Please note in order for the "Node reference path" to work, "Content types that can be referenced" must be saved first.
  2. See for a screenshot of the resulting field widget in an order edit form, note the order of the dropdowns in the widget is the reverse of the node reference path.

Views Filter

  1. See for a screenshot of the extra setting form when you attempt to add a filter for Content: Tax Zone node reference field
  2. See for a screenshot of the filter setting for path "Order.TaxZone-TaxZone.Zone-City.State-State.Country"
  3. See for a screenshot of the views filter in action in live preview

Looking for support? Visit the forums, or join #drupal-support in IRC.


SanDiego’s picture

This looks complicated. Setup and configuration of this module would make a great Drupal screencast.

beumont’s picture

I cannot set it up :( I still have

asiby’s picture

Looks interesting. I bet it is a great module, by despite my many years of experience in Drupal development, I can't seem to understand the logic of this. All I need is a way to use node reference while filtering the referenced node using a taxonomy tree instead of using the auto-complete widget alone.

Sorry guy, but considering the new concepts used by this module, its configuration is not intuitive at all.

apmsooner’s picture

This module was confusing to me too at first but am getting it to work now after further testing. Let me see if I can help explain how to use this with a specific example:
step 1. Create content type "car"
step 2. Create content type "model"
step 3. Create content type "color"
step 4. Create a normal node reference field on content type "model" that refers to content type "color"
step 5. Create a hiearchical select node reference field on content type "car" that refers to "model" and save the field (call it "specs" for example). Now edit the field and you should see something in the node reference path dropdown. It will probably look like this: model.color. You'll see this because car relates to model and model relates to color. If color related to something also then you might see model.color.something_else
Select this node reference path and save the field. Optionally under the node reference path field, there was a link to configure the hierarchical settings further so feel free to modify but if you've gotten this far, when you now create a new content of type car, your "specs" field will allow you to first select a model in the first field and dynamically generate a field color that references the model. So with deeper reference you might see model.color.metallic for example. The main thing to remember by the way is you only need the hs node reference field at the parent node level, all other node references will be normal node reference fields. Hope that helps someone that is considering the module.

vivdrupal’s picture

With the Car - Model - Color example also, can just get the select list of the Model. No hierarchy.
Looking for some more clues. I hope no conflict with other modules is the case!

The features shown in the examples are awesome. But some detailed example from those who have already implemented the module would be great.

Looking forward.

apmsooner’s picture

If you want to post some screenshots of your setup, I'd be happy to see what the problem is.

vivdrupal’s picture

Thank you so much for your offer.

The problem was that data in each of the content types was not linked to the node reference field up in the hierarchy!
Edited each content to select a node reference field option and the hierarchical list is now up.

Alexander Matveev’s picture

Can't get it work, something wrong at Step 5.

> It will probably look like this: model.color.
Yes, it is.

> Select this node reference path and save the field.
Ta-da! When I select model.color reference, AJAX starting to load something and this never ends: All the form is grayed and Save button does not work.

Is there anything can I do with this?

orgnsm’s picture

i'm having trouble and wondered if anyone knew why when i add a hierarchy to a dropbox it displays it as flat [non-hierarchical -- two lines are added to dropbox instead of one], something about my configuration is causing this because it used to save correctly.

also, will it ever be possible to use Views to populate HS NR [instead of by content type]?

ablommers’s picture

Hi all,

I am looking for a way to use a view to be able to filter specific content. I cannot get it to work. Is this option unsupported bij HS NR? Or am I doing something wrong with the views. Any directions or hints on how to construct the view in that case?

Many thanks,


hugopery’s picture

Hello !

I really want to use this module and after 2 days of tests I'd like your help !

I've created the simple Car/model/color exemple. In my Node Reference Path select list (of the color Content Type), I see, click on it and then it disapear ! I've selected and saved the "Content types that can be referenced" before configuring the HS. So please tell me what could be my mistakes before I had no hair !

Thank to all


Note : in the Car/Model/Color, the HS is at the top of hierarchy (i.e. Car) but in the Country/State/City exemple (HS Readme.txt) the HS is at the bottom of hierarchy (i.e. City) .... who is right ?

apmsooner’s picture

You might look back at my example I provided because model.color should be the reference path in my example, not Hierarchy goes like this car - model - color. Car is the hierarchical select node reference field to model while model is linked to car through regular node reference. I think you just have the paths reversed somehow.

ablommers’s picture

Hi Hugo,

I experienced the same problem today after upgrading to v 6.x-3.5 of the HS module. Jumped back to 6.x-3.3 and everything seems to work fine again.

Hope this helps,


kid_baco’s picture

I was using 6.x-3.6 and having the same issues. After a day of utter confusion, I finally found this post and decided to give it a shot before giving up. Downgrading to 6.x-3.3 worked for me also.

Now I just have to figure out how I can save a node lineage.


gejo’s picture

With v6.x-3.8 it worked well until 3th level.
When I select the 'node reference path' in the 4th level, it disappears.
Downgrading to v6.x-3.3 (as Ablommers suggested) worked for me.

jnroche’s picture

Please help. I am able to make it work using taxonomy heirarchy but not using node reference. I would prefer node reference as you can add extra fields to these items like description, geo points etc..

Here is my set up:

[ City -> Developments -> Projects ]

(city) (development) (project)
Dubai -> Arabian Ranches Development -> Al Reem Project

And lots of cities that relates to their own set of developments -> again with their own sets of projects.

Development Node contains node reference to City (not heirarchical)
Project Node contains node reference to Development (not heirarchical)
and finally,
Property Item Node which contains the heirarchical node reference to Development, but when I reference it to 'Project' (which should be the case) it disappears upon selecting it!

I do not know what is wrong please help!