Tags autofill to avoid duplicating [SOLVED]

Hi,

When using the Tags field, you can make mistake when adding tags, for example tool vs tools vs Tool etc. Would it be possible to have an autofill solution for this type of field (avoiding duplicating the tags)?

Thanks

It exists already. Simply add "autocomplete":["tool","second option","and so on" to your field options. Now an popup shows up with autocomplete options while typing into the tags field.

For known tags that could work, but the users keeps adding new tags, I won’t be able to keep up (updating the fields all the time). There’s no solution to fetch the existing Tags in realtime?

I solved that riddle for you (I wanted to have this function for a while, too and I fiddled with a similar problem a few hours ago).

I didn’t do much tests. Maybe you have to modify it a bit to your needs.

The basic concept:

  • bind a route
  • select all existing tags
  • return them as array
  • create a custom tag (copy/paste from /modules/Cockpit/assets/components/field-tags.tag
  • modify it to use the returned array as base to autocomplete
  • use the modified field instead of the tags field

Usage:

Modified field:

Original field:

Wicked!
Thank you very much.

No problem.

PS: You can mark a thread as solved by clicking on the tree dots under an answer and than on the square with the checked item.