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.
Comment | File | Size | Author |
---|---|---|---|
#20 | field.png | 34.71 KB | adaddinsane |
#17 | search_references-1309792-17.patch | 1.1 KB | MiSc |
Comments
Comment #1
mpotter CreditAttribution: mpotter commentedForgot 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.
Comment #2
abulte CreditAttribution: abulte commentedVery useful, thanks ! Make it a README !
Comment #3
gmclelland CreditAttribution: gmclelland commented@mpotter - Thanks for the write-up, very helpful.
Comment #4
John Morahan CreditAttribution: John Morahan commentedAs I understand it, the "Reference" display is created by the References module itself, and not by this module.
Comment #5
di3gopa CreditAttribution: di3gopa commentedShouldnt be "references" module a dependency of this module?
Comment #6
di3gopa CreditAttribution: di3gopa commentedShouldn't be "references" module a dependency of this module?
Comment #7
John Morahan CreditAttribution: John Morahan commentedNo because you can also use it with entityreference instead
Comment #8
LTech CreditAttribution: LTech commentedI'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?
Comment #9
robydago CreditAttribution: robydago commented@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.
Comment #10
drupalok CreditAttribution: drupalok commenteddoes SEARCHING really work with ENTITY references? i can't find the option of "Views - Nodes that can be referenced" there.
Comment #11
John Morahan CreditAttribution: John Morahan commentedIt 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.
Comment #12
Les LimThanks for the write-up. Changing title and category.
Comment #13
Katrina B CreditAttribution: Katrina B commentedTips:
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.
Comment #14
snevins CreditAttribution: snevins commented@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.
Comment #15
Katrina B CreditAttribution: Katrina B commented"Reference" display is not needed for this to work.
Comment #16
MiSc CreditAttribution: MiSc commentedUpdated the instructions:
I will do a patch for a README.txt.
Comment #17
MiSc CreditAttribution: MiSc commentedPatch attached.
Comment #18
clashar CreditAttribution: clashar commentedmpotter, 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.
Comment #19
eme CreditAttribution: eme commentedIndeed, 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...).
Comment #20
adaddinsaneLikewise, 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.
Comment #21
BrankoC CreditAttribution: BrankoC commentedThere 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.
Comment #22
BrankoC CreditAttribution: BrankoC commentedMiSc, I have merged your README.txt with mine in http://drupal.org/node/1478826#comment-6373880 .
Comment #23
berdyshev CreditAttribution: berdyshev commentedmarking as duplicate, since the documentation patch is in work in #1478826: Add a README.txt that describes how to install and use the module
Comment #24
wirka CreditAttribution: wirka commentedApologize 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.
Comment #25
MiSc CreditAttribution: MiSc commentedI have a screencast up where I talk about how to do it: http://www.wunderkraut.com/blog/screencast-references-dialog/2013-01-25
Comment #26
texas-bronius CreditAttribution: texas-bronius commentedFor 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.
Comment #27
MiSc CreditAttribution: MiSc commentedPlease do not rename issues just because to highlight your own answer (but good with a handbook page).
Comment #28
liquidcms CreditAttribution: liquidcms commentedi 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!!
Comment #29
mpotter CreditAttribution: mpotter commentedGoing 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.
Comment #30
mpotter CreditAttribution: mpotter commentedAlthough 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!!
Comment #31
mpotter CreditAttribution: mpotter commentedblah, it was the same as in #28...needed to clear cache.
Comment #32
Anybody#1 is missing in the documentation (Patch) isn't it?