0

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.

  • For drupal 6 there is a module, drupal.org/project/hs_nodereference. but it is not ported yet into 7 – Anoop Joseph Oct 11 '12 at 11:55
  • @Anoop Joseph: How can we do this in drupal 7. Can we use custom coding? If yes Can you please give me an idea on how to start up. – Cindrella Oct 11 '12 at 11:59
0

You can use custom coding to achieve this, here the idea

  1. Add a script to call a ajax call back on change your first node reference select list.
  2. Define the menu callback in your custom module.
  3. On change of first select list, get the selected node id and pass to above defined function
  4. Write the query to get depended node ids
  5. Output it as

    $options .= "nid." ".$selected." >".$data->node_title.""; echo $options;

  6. In your jquery ajax success part, add it eg: success: function(data) {
    f(data){$('#your-second-noderefernced-field').html(data);}

Hope this idea help you to proceed on

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.