After my first post on SharePoint Taxonomy Show Fields as a drop-down,the question came up to “What do I do with multi-selection taxonomy fields?” or “Can I also customize the script for multiple selection?”.
That’s why I sat down and first thought about how to display such a multiple selection taxonomy field at all. After some research, I finally decided how to implement it.

The implementation

To customize the display for multiple selections, you only need to customize the ManagedMetadata.js file from the first post. First, it had to be distinguished whether the current field is a taxonomy field with or without multiple selection. This can be easily read from the schema via the context.

In addition to the drop-downs, the following components are required:

  • A box with the currently selected elements (for the user).
  • A hidden field with the current items (for SharePoint).
  • A button to add new elements including a modal dialog.
  • A button to remove items.

Furthermore, the script can be set whether only the name of the term or whether the whole path should be displayed. There was a problem because they were reused taxonomy values. These then have multiple paths and only the main path is returned. I was able to remedy this by reading the term not from the TermStore, but directly from the correct TermSet.
Before:

var term = termStore.getTerm(guid);

After:

var term = termSet.getTerm(guid);

Bottom line

The customized file with all changes can be found here.