My goal is to allow a user to select multiple tags from a list of existing tags in the database.
I had trouble figuring out how to create a new tag if one wasn’t already in the list.
Attempt 1 - Using Multidropdown plugin - Trying to something similar to example 2 in this video. I have it set to start roughly where I started working from. Also, there way you build the expression has updated, there is a place where it seems you now will choose “every items field” instead of “field” as it is shown in video. There is several places where this pops up.
The trick here is that it is suggested to set the type of choices to text, which lets you enable the option to add new items. I had this working except I couldn’t figure out how to bind the list back to items and properly update the database (due to the text field setting but if you chose my data type, it would hide the create new item option). If that works that would be everything I needed to do. Just map the input text to the correct field and it would be good to go.
Attempt 2 - Using the search element. There is a place where is says you can allow entries not in the list while typing. I think this would be how I could create a new item, but I can’t quite figure out how to code it. I am close, I have a when element is changed workflow that adds the tag to the item that we are editing. I just can’t get the new item creation working in this model.
Hoping to get some feedback on a better way to approach this : )
Edit: I have a basic version of this working but I am not making it work through the Tag datatype. I modified the datatype
Post with a
tag field defined as a list of texts. The tags are currently stored in the post type they are tagging as item1,item2,item3. I am not sure how flexible this approach will be, as I want to use some type of autocomplete fields to encourage tag reuse across the platform. I have not figured out how to approach that yet.