Populate second node reference field based on what first node reference field is selected

215 Views Asked by At

I have 2 content types. "ABC" content type and "DEF" content type. In "DEF" content type i give reference to "ABC" node reference.

I am building another content type called "XYZ" where i give node reference to "ABC" and along with it i give node reference to "DEF" content type.

My problem is that i need to filter out the "DEF"(node reference to "DEF") drop down based on what "ABC" is selected from previous "ABC" drop down.

How to achieve this.

Any help is appreciated.

1

There are 1 best solutions below

0
On

There are few ways to implement what you need.

One of them is to implement hook_form_alter() to alter your content type insertion/editing form and then use #states property to alter the behavior of the drop down items.

Hope this helps... Muhammad.