I am using References dialog 7.x-1.0-alpha4 and Entity reference 7.x-1.0-rc3+1-dev. I need to use references dialog so that users can add entitities to reference from within another form, and this is working. However, when I try to set the selection handler to "Views: filter by an entity reference view" rather than a dialog I get the message, within the form, not as a popup, 'the selected selection handler is broken'. Simple works ok. With rc3 it produces an Ajax error, which I think corresponded to an earlier reported issue. I think rc2 had other critical errors. With rc1 there is only the option to have a simple selection handler. On my production site I am currently just sticking with rc1 for now.
I don't know if this is an issue with References dialog or entity reference. I am posting here because there seems to have been some selection handler issues with entity reference lately.

Comments

Tara1981’s picture

Hmmm... I added a nid to the fields in the "reference dialog search" view, cleared the cache, and tried again. This time the message changed to "No eligible views were found. Create a view with an Entity Reference display, or add such a display to an existing view."
I'm thinking (though not certain) this issue might be me misunderstanding what I am doing with references dialog. Sorry if I've wasted any time...

rsgracey’s picture

Whooop! I think I figured it out! (I was in the same place as you.)

The Concept

The Entity Reference display works as a "select" builder. Once you've created a View that contains exactly the values you want to use as the selection, you then add it to the field you're going to be filtering (ultimately) in the View you want filtered.

My example: I'm building a calendar for speaking engagements. Every engagements has a speaker and a contact--both coming from the Person content type. My challenge was to be able to filter the engagements by speaker, using something besides a blank text field. I really wanted an autocomplete field, so that the user wouldn't have to type the names completely, but I also only wanted the "speakers" to come up as choices.

The Steps

  1. Build the "select list."
    • Create a View for the Content Type that will provide the list ("Person," in my case).
    • Create an "Entity Reference" display. Choose the field that you want to appear in the "select list." If you choose more than one field to be displayed, they will all render in the select list.
    • In the Entity Reference | Settings and also the Inline fields | Settings links, choose the inline field(s) to appear in the select list.
    • Save the View.
  2. In the Content Type that will be filtered ("Engagements," in my case), change the settings for the field that will be filtered ("Speaker," in my case)."
    • In the Field settings, where it says, "Entity selection mode," choose "Views."
    • Find the entity reference display that you built above.
    • Select either or both the rendering options--autocomplete and/or select list.
    • Save the field settings and the content type.
  3. Create the View to be filtered.
    • When you get to the "filter" fields, add the field you just changed above.
    • Its settings now should have an "autocomplete" field. (I don't see where to make it a select box, but I wanted the autocomplete.)
    • The rest of the options seem to be standard for exposed filters.

Let me know if this was helpful, or whether I missed a step somewhere.

FiNeX’s picture

EDIT: I've had a problem with the entityreference display, I've cleaned up the cache in order to fix it. Sorry for the noise.

Devin Carlson’s picture

Category: Bug report » Support request
Issue summary: View changes
Status: Active » Closed (fixed)