0

is there anyway to populate nodes when type a custom content type value using node reference in drupal 7 ?

node refernce populate nodes when we start typing the title of the nodes . is there any option in drupal 7 that we type custom field and it populate the related nodes as it is working with the title.

Thanks

3 Answers 3

1

You can select a View in Content Settings in "VIEWS - NODES THAT CAN BE REFERENCED".

Let that View return whatever field values you want to return.

0

Try changing the widget type from "autocomplete" to "select list" of the node reference field of your content type at manage fields page.

2
  • thanks to all for there replies. but it did not solve my problem. i used node reference. when i start typing the titles of node than it displays options . i want to type a custom field other than title than it should display me the options of nodes which have this value of custom filed ex- postalcode. drupal should populate nodes which have the postalcode which i type. thanks
    – eweb
    Oct 4, 2013 at 11:38
  • @eweb Yeah right Oct 4, 2013 at 11:41
0

If i get you right, you have a content type with node reference field, so when you refer a node instead of having node suggestions directly you want them to filter down by provided content type name.

Just to make sure you did'n miss this while adding the node reference fields you will get the option of choosing the content type as "Content types that can be referenced",this is one layer where you can filter/limit the node suggestions. But yes there are chances when you want to filter the suggestions on the fly,which will be interesting to have.

here is my view for implementing this-

  • Build a custom autocomplete field ,backend for this can be served by a custom query.
  • keep the node reference field as hidden field.
  • While saving the node assign value(nid) in custom field to hidden node reference field.

Edit Easier way will be overiding node_reference_autocomplete_value() in node_reference.module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.