I spent some time with this module and it works well to use a View allowing users to search for nodes. However, it took me a while to figure out how to use it. So here are some pointers for others:

1) After installing this module, configure your Content Type. Go to the Node Reference field you want and Edit it and enable the Search option. In the "Views - Nodes that can be referenced" section there won't be any view choices yet. That's normal.

2) This module adds a new *display* type for a view. Not a formatter or view style. In fact, it adds *TWO* displays. First create a View, then in the Add Display drop-down, select "Reference Dialog search". This is the dialog the user will actually see. I used a Table layout with several exposed filters for filtering the content. Be sure and turn off an Title links to content since you normally won't want content to be displayed when the user clicks a node title.

3) In the Display Settings in the middle column of the View UI, select the Field Instance and your Node Reference field from (1) should be displayed. Enable that.

4) After creating the Reference Dialog display, you then must create the "Reference" display. Ensure the correct field is still shown in the Field Instance. Save the Views.

5) Go back to your Content Type and edit your node reference field. Now you should see your Reference view in the drop down box at the bottom.

I'm still a bit un-clear why two different view displays are being used. It all seems a bit convoluted. Maybe I'm still not understanding the module correctly, but the above steps allowed me to get it working properly. It's very possible that some of the steps were not needed. Hopefully the module maintainer can help clarify it a bit better.

Finally, it would be really nice if the Module created a sample View that we could just clone and use.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

mpotter’s picture

Forgot to mention:

2a) Be sure the view contains a NID field. You can Exclude it from the display if you want, but it needs to be in the view.

abulte’s picture

Very useful, thanks ! Make it a README !

gmclelland’s picture

@mpotter - Thanks for the write-up, very helpful.

John Morahan’s picture

As I understand it, the "Reference" display is created by the References module itself, and not by this module.

di3gopa’s picture

Shouldnt be "references" module a dependency of this module?

di3gopa’s picture

Shouldn't be "references" module a dependency of this module?

John Morahan’s picture

No because you can also use it with entityreference instead

LTech’s picture

I've installed and enabled the module but I don't have the option 'Reference Dialog search' in the view display drop-down. Why not? Also could someone explain to me the purpose the module?
I'm trying to have one form for one content type that when saved will create two node, one using some of the fields in the form and one using the other fields on the form. (It is important for users that I don't have two separate forms).
Does this module enable me to do this?

robydago’s picture

@LTech

I don't think this is the module you are looking for.

Basically this module will help users enter data into reference fields.

Instead of typing directly inside the reference field a user can click on the "search" button next to the reference field.
By doing this, an overlay window is open where the user can search and select a node\entity out of the list displayed (configured via Views).
By clicking on a node\entity, the overlay window is closed and the selected node\entity (what you clicked on) title and id are used to populate automatically the reference field.

drupalok’s picture

does SEARCHING really work with ENTITY references? i can't find the option of "Views - Nodes that can be referenced" there.

John Morahan’s picture

It doesn't exist, yet, but there's a patch to add it at #1253776: Add views support for providing a list of entities or bundles (views filtering, relationships, etc). I don't know if that works with the search in this module, though.

Les Lim’s picture

Title: Needs Documentation » Document how to expose the "Search references" function on a reference field
Category: support » task

Thanks for the write-up. Changing title and category.

Katrina B’s picture

Tips:

Node reference field must be an autocomplete field in order to be able to turn on the Search functionality in the Edit pane for the field. It does not work with "select list" (I have not tested it with checkboxes/radio buttons).

If the Search link does not show up on the node reference field (when you create or edit a node), try clearing caches.

snevins’s picture

@LTech: I know this is a little late, but actually you can use this module for what I think you are trying to do. You'd need to enable the Create dialog. The search dialog, what this thread is about, is probably less important to you.

Katrina B’s picture

"Reference" display is not needed for this to work.

MiSc’s picture

Updated the instructions:

On the settings for the field on the content type, click the search option on the settings, and save the settings.

Create a new view, and add the display Reference dialog search.
At the settings References dialog, you could now attach the reference field to the display. If you have more than one referenced field, you could choose them, if you would like to use the view for more fields. Save the view.

Clear the cache. Now you should have the search option for the field.

I will do a patch for a README.txt.

MiSc’s picture

Status: Active » Needs review
FileSize
1.1 KB

Patch attached.

clashar’s picture

mpotter, thank you very much for pointing out this:

2a) Be sure the view contains a NID field. You can Exclude it from the display if you want, but it needs to be in the view.

eme’s picture

Indeed, it would be great to create a sample view. Did not succeed into making the explorer functions (and I'm far from being new to Drupal...).

adaddinsane’s picture

FileSize
34.71 KB

Likewise, and I'm definitely no beginner. And my end client is not happy, they had this function in their D6 site and I can't make it happen on this one. (I'm not blaming anyone -we're all volunteers - it's just frustrating.)

Anyway, I'm trying to use this with entityreference

Two problems:

1. The search button/link (whatever it is - I've never seen it) does not appear;
2. I get an "add" option for every content type as soon as I switch to the view which is utterly pointless from a UX viewpoint. (image attached)

I am right on deadline, if anyone knows how to fix these issues I'd be very grateful.

EDIT: I don't get a new 'Views - Nodes that can be referenced' section (but I am creating the View) and I'm on 7.x-1.0-alpha4 (no patches) but I do see the View in the "View used to select the entities" field when I switch to Views selection.

brankoc’s picture

There is a generic issue requesting documentation: http://drupal.org/node/1478826

I added a README.txt to that issue before I came across this one.

brankoc’s picture

MiSc, I have merged your README.txt with mine in http://drupal.org/node/1478826#comment-6373880 .

berdyshev’s picture

Status: Needs review » Closed (duplicate)

marking as duplicate, since the documentation patch is in work in #1478826: Add a README.txt that describes how to install and use the module

wirka’s picture

Apologize for my english.
One thing that has to be noted is, the references display is used to validate selected nid. Each selected nids via views with reference dialog search display have to match one nid of result of views has references display. And then, it's possible to use pager in reference dialog search but have to use Display all item in references display.

MiSc’s picture

I have a screencast up where I talk about how to do it: http://www.wunderkraut.com/blog/screencast-references-dialog/2013-01-25

texas-bronius’s picture

Title: Document how to expose the "Search references" function on a reference field » Document how to expose the "Search references" function on a reference field (READ TO THE BOTTOM)

For anyone just joining in, it's fun but more productive to skim the Entire thread here. To consolidate, I fired up a handbook page here:
https://drupal.org/node/2019505
Please feel free to move across the complete "Adding a Search" steps thereto.

MiSc’s picture

Title: Document how to expose the "Search references" function on a reference field (READ TO THE BOTTOM) » Document how to expose the "Search references" function on a reference field

Please do not rename issues just because to highlight your own answer (but good with a handbook page).

liquidcms’s picture

i used Entity reference field and created references dialog search display in my view and added nid. and in the view i "attached to" the field i wanted to use this with - still no luck getting a search icon.

then saw post #13 - cleared all caches and it worked.. ughh.. perhaps the view handler could do a clear cache on submit?

ps - love this module!!

mpotter’s picture

Status: Closed (duplicate) » Active

Going to re-open this because the patch in #1478826: Add a README.txt that describes how to install and use the module needs to include the information here about creating search views. Or, if you want to close this, link to it from the other issue. Because it seems that the info in this issue has been lost.

mpotter’s picture

Although looks like the docs in the OP need to be updated. I'm having trouble getting the Search button to show up and notice that there is just one type of Search Reference view now rather than two. So looks like the UI has changed but I still can't figure out how to get the search button enabled on my entity reference field. So this definitely needs documentation!!

mpotter’s picture

blah, it was the same as in #28...needed to clear cache.

Anybody’s picture

#1 is missing in the documentation (Patch) isn't it?