Any solution for this issue?
I have the same problem.
I created a custom autocomplete field which gets the JSON formatted results from API.
I want to bring the values of multiple fields, but I don't want to show in the text field.- 🇬🇧United Kingdom scott_euser
The problem is we use input textfield to do auto-complete on. This fundamentally does not have separation between value and label.
I expect wrappers for the select element are better suited like Select2 ( example here → of using it in Drupal).
There was https://www.drupal.org/project/chosen_ajax → in Drupal 7 which could be ported to D10+. The idea is the same as the Select2; use Chosen's ajax callback functionality to populate the select list dynamically with a callback to pass data into it (and in both cases since they are select element based, they allow value + label).
Probably either route could be via contrib rather than core?
- Status changed to Closed: won't fix
10 months ago 3:33pm 1 March 2024 - 🇬🇧United Kingdom scott_euser
Actually it looks like the Chosen Ajax option relies on a github extension to Chosen that has not been touched for 5 years. Would suggest sticking with Select2 options given that is supported within the core of Select2 and has documented examples of using it within Drupal like https://drupal.stackexchange.com/questions/297533/populating-select2-wit... as well.
Wondering if as a result we can mark as 'Closed (won't fix)'? We already have 🐛 UX: Hide entity ID in autocomplete widget Needs work for example for the existing field which has had engagement from Core maintainers/product owners. Feel free to disagree and re-open.
- 🇫🇷France andypost
There's ongoing work in ✨ Implement chips based autocomplete designs Active
Moreover there's similar issue 🐛 Entity reference field View output is not used for selected entity display Needs work