I have a field called “fruit_type” which is a node reference to a “fruit” content type and an auto-complete field.
By default drupal provides title of node and nodeId in auto-complete field like:
mango [nid:9]
My requirement is to show the field from “fruit” content type called “fruit_species”. So it should look something like this:
mango [spec:mangifera indica]
But the further functionality of node reference should remain the same, i.e. on content page I should be able to get the values entered in this field as a reference to a node of type “fruit” and redirect me to the content page of this fruit.
Is it possible to achieve? If yes how can I achieve this?
Edit: FYI: I am using a Drupal 6
Your best bet would be to use Nodereference Explorer as it’s what I use when I need more than what autocompelte offers. It doesn’t do what you want but maybe is what you need.
Other than that, you could implement your own autocomplete module. Using one of the many widgets available online.
For the results, you’ll need to set up a hook_menu to build your results (and link them to the widget) and then using hook_form to process them before creating the node reference.