How to display tags from an element inside the repeater using selection tags

Question:
I would like to connect the tags of an element inside a collection, so that each element inside the repeater display their tags (categories).

Product:
Wix Studio

What are you trying to achieve:
I would like to connect the tags of an element inside a collection, so that each element inside the repeater display their tags (categories).

So if Item 1 has ‘tag1’, ‘tag2’, and ‘tag3’ in their tags field in the collection, I want to display them on each item in the repeater. I will disable the selection tags since I don’t want to collect any data, simply display the tags.

What have you already tried:
For some reason, it is impossible to connect each element tags value using the selection tags.

I’ve tried multiple approaches, like using another collection and try to reference the values from another field, use an array field. But nothing works, It never populates the selection tags with their value.

Can anybody help with that?

Hello, vinnysantini

I can see your query, as per your query i give you my best answer please see below information and follow step by step…

According to the Wix Help Center, you can use the Selection Tags element to display tags from your collection on your site. You can also connect the tags to a repeater so that each item in the repeater shows its tags. To do this, you need to follow these steps:

  1. Add a repeater to your site and connect it to a dataset that is linked to your collection.
  2. Add a Selection Tags element inside the repeater and connect it to the same dataset as the repeater.
  3. Click the Connect to Data icon to connect the tags to your collection.
  4. Click the Connect a dataset drop-down and select the dataset.
  5. Click the Tag value connects to drop-down and select the field that contains the tags in your collection. The field type must be Tags.
  6. (Optional) Disable the selection tags by clicking the Settings icon and toggling off the Allow Selection option.

You can also watch this video here: https://support.wix.com/en/article/cms-formerly-content-manager-connecting-text-elements-to-collection-fields/DogNeedsBest to see a demonstration of how to use Selection Tags in Wix Studio.

I hope this helps. If you have any other questions, feel free to ask me. Have a great day! :blush:.

Best regard,
Booker82EVail

Thank you for your answer @user1483

It does in fact work to connect a selection tags element to a collection, but in my specific case if you look closely on the screenshot, the tag field from the collection (in the dataset panel) cannot be selected when used inside of a repeater.

My need is to display the tags value of each item inside the repeater.

I know this is very late - but I’m posting this in case someone else is looking for an answer to this.

I needed to display tags of CMS items in a repeater I couldn’t find a nice simple answer. Or maybe im bad at Google.

But anyway - for anyone else looking - the tags input item are usually used for filtering and data collection, but you can make it display the tags associated with an item in a repeater.

  • Create your repeater, connect to CMS
  • Add an input tag item, and style the *disabled* tags, to how you want them
  • Turn on coding and select the tag item and ‘disable‘ it
  • Then just bang in this code:
$w('#repeater1').onItemReady(($item, itemData) => {
	let options = [];

	itemData.arraystring.forEach(tag => {
		options.push({label:tag,value:tag})
	});

	$item("#selectionTags1").options = options;
})

Basically, it just goes through each tag (arraystring) in the current repeater item and creates a tag option with it.

Then after assigning each tag it overrides the selection tag options with the array of options we created.

3 Likes

I just tried it and it works just fine. Thank you for sharing that solution, even if it has been almost a year :smiley: . That’s going to be helpful!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.