1

Is there any way to have a term reference autocomplete field search other fields than just the title? In my case I have a organizations vocabulary with the taxonomy name and an acronym. The main point of adding an acronym field is to stop users from putting in the acronym in place of the full organization name.

If I turned it into an entity reference field would, the autocomplete widget type allow me to do this?

  • so you want users to be able to autocomplete both name OR acronym in the same field? – longboardnode Jun 28 '16 at 16:11
  • I want to type the acronym and get the name as a result. – UltraBob Jun 28 '16 at 22:39
  • You can create a custom autocomplete that looks up the acronyms and submits the name upon selection. You can see more info in this [post]( drupal.stackexchange.com/questions/78899/…) – longboardnode Jun 29 '16 at 14:54
  • OK, that would be cool, I'll read up on that a little later. To answer my second question on here, the entity reference field widget will allow you to use views for the autocomplete so you can get it to search and display whatever you want. Unfortunately, at least on its own, it seems it can't create new taxonomy terms. – UltraBob Jun 29 '16 at 23:57
  • How will users create new terms, since you're using acronyms and full names? what if one user enters the acronym but another user enters the full name? this could quickly become unmanageable – longboardnode Jun 30 '16 at 13:31
0

As far as I've been able to determine, there is no way to modify what autocomplete searches in a term reference field, though if seems possible, even likely that there might be a module or hook that does this, I didn't find it.

To answer my second question, yes, making this an entity reference enables the use of views to power the autocomplete, at which point you can handle the formatting and search fields of the autocomplete.

Better answers on this are very welcome!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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