I'm using Drupal 9.2. I have created entity reference views and use them as filter for entity reference fields (autocomplete widget). When I'm using only "Content: Title" field everything works as expected. When using more fields either hidden (rewriting Title) or visible, I get "There are no entities matching [my selection]" error on save.

*** Edit n.1 for more details:

I have a content type that has an entity reference field (autocomplete widget). When the user selects the referenced node I want the options to display something different than the node's title.

So I use "Views: Filter by an entity reference view" as Reference method of the field and I have created a view with an "Entity Reference Display" to use with the field.

If the only Field used in view is "Content: title" everything works as expected and the entity reference field is saved. If I use let's say "Content: Short name" then autocomplete field is indeed searching and showing Short name, but when I save the form I get "There are no entities matching [Short name]".

I have tried using only "Content: Title" and rewriting output and I still get the same problem.

The same happens if I use a view with users and I show firstname and lastname instead of username. Autocomplete widget searches and shows options with the selected fields correctly but saving the form result in error with no entities matching.

I really don't know how this feature works to start debugging. Is the actual referenced node id saved in a hidden field or element data attributes?

Does anybody have any idea why this is happening or how to debug? Thanks

*** Edit n.2

After some debugging I can see that method matchEntityByTitle of EntityAutocomplete is called which in turn calls getReferenceableEntities of ViewsSelection. To validate selechion this plugin searched for a match of the "value" (fields combination) in any of the fields marked for search. This normally returns no results and the field is not validated. So is this normal behaviour and this feature can only work with title (or single field) values or do I miss something else?

  • What are your Entity Reference Format settings in Views?
    – prkos
    Commented Jun 3, 2021 at 14:11
  • format: entity reference list, settings: all fields selected for search Commented Jun 3, 2021 at 14:34
  • Can you update the question with all information, what fields are you using, when showing the fields is the search working, is only rewriting causing problems?
    – prkos
    Commented Jun 3, 2021 at 15:57
  • I have updated with more info. The problem is the same no matter if I use rewrite on Title or just show more fields either inline or with field wrapper elements Commented Jun 4, 2021 at 5:59
  • AFAIK basically everything in views always searches for unmodified values of database fields, and completely ignores whatever you set on UI (rewriting fields, different language rendering,... etc all is done AFTER the SQL query, you can not search for any result/modification done by the render pipeline)
    – Hudri
    Commented Jun 4, 2021 at 7:55

1 Answer 1



the problem was that I used method proposed here


to remove id in parenthesis. This would result in validation being done by matchEntityByTitle and failing.

So the real problem would be how to hide id in parenthesis and still be able to use different fields from entity reference view.

Your Answer

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

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