# Display Tags based on Previous Selected Tags from a Data Collection. 

**URL:** <https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [December 16, 2021, 6:56pm UTC](https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987 "2021-12-16T18:56:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pazescobar18](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@pazescobar18](https://forum.wixstudio.com/u/pazescobar18)\
**Post date:** [December 16, 2021, 6:56pm UTC](https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987/1 "2021-12-16T18:56:13Z")

</div>

So I have a Data Collection where the user selected Tags on a form. I want to Display these Tags on their user profile page (I only want the tags they selected to be displayed). I also want to allow these tags to be reselected as filters on a gallery connected to other profile pages.

Is there any code ideas to make this happen? If I can get some help to the right direction that will be appreciated. thank you.

Collection: userProfileData  
Dataset: datasetRead  
Tags Field: categoryTags  
Element: profileTags

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [December 16, 2021, 7:17pm UTC](https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987/2 "2021-12-16T19:17:42Z")

</div>

The description is not clear enough. Please rephrase and elaborate,

---

<div class="post-metadata">

**Author:** ![pazescobar18](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@pazescobar18](https://forum.wixstudio.com/u/pazescobar18)\
**Post date:** [December 16, 2021, 9:57pm UTC](https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987/3 "2021-12-16T21:57:04Z")

</div>

I hope this explanation is a little better to understand.

I have a Collection with data from a form users filled to create a Dynamic Page. In the Form the users selected some tags from about 90 options.

In the dynamic page, created from the form, I want to display the selected tags (not all 90, but only the tags that were selected and stored in the collection) these tags would then be used by the user to filter a repeater element in the dynamic page.

I’m looking to be pointed to the right direction in terms of wixcode to Display the tags from the collection field and use them as a filter to a repeater.

Example: the user selected 15 out of the 90 tags in the form to create the dynamic page. In the Dynamic Page I want to ONLY display the selected 15 as options to filter the repeater .

\*\*This Tag options would vary depending on who the logged in user is.  
I hope that explains what I’m trying to do. Thank you for your help and patience.

---

<div class="post-metadata">

**Author:** ![J.D](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/j.d/32/7312_2.png) [@J.D](https://forum.wixstudio.com/u/J.D)\
**Post date:** [December 17, 2021, 9:49am UTC](https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987/4 "2021-12-17T09:49:03Z")

</div>

I don’t know what data you have in the repeater.  
But let’s say you have 2 datasets on your page:

1. userDynamicDataset (which represents the user selection data item)

2. repeaterDataset (which represents the general selection tag items, where the title is the selection tag value)  
Then do something like:

```javascript
let dataReadyStatus = 0;
$w.onReady(() => {
$w('#userDynamicDataset, #repeaterDataset').onReady(() => {
dataReadyStatus++;
if(dataReadyStatus > 1){
    $w('#repeaterDataset').setFilter(wixData.filter()
    .hasSome('title', .$w('#userDynamicDataset').getCurrentItem().tags)
    )
}
})
})

```

---

<div class="post-metadata">

**Author:** ![pazescobar18](https://avatars.discourse-cdn.com/v4/letter/p/71e660/32.png) [@pazescobar18](https://forum.wixstudio.com/u/pazescobar18)\
**Post date:** [December 18, 2021, 1:43am UTC](https://forum.wixstudio.com/t/display-tags-based-on-previous-selected-tags-from-a-data-collection/987/5 "2021-12-18T01:43:10Z")

</div>

@jonatandor35 Thank you, I’ll try to see if I can use this information.

But to clarify my main problem its actually displaying the tags from the dataset.  
Just so you have a little visual of what I’m trying to do: The page where this will be taking place is not in a dynamic page, it will be from a members only page. the filter Tags you see under the Image here is where my problem is; I want to display tags only from the logged in Users Data already previously selected and stored. then I want those Tags to be used to filter the Gallery Repeater that will show a list of all Dynamic Pages by different users.

 ![](https://us1.discourse-cdn.com/wix/original/3X/1/2/12dd1f44c52769e6e10976726e60651ad0dcb0b2.png)

As of right now I use this code to display tags, but its not clean being an HTML code that breaks when there is a space and doesn’t maintain the tag as a whole. Example you can see where the tag breaks for “Emergency Response Units” if there is a way to display tags from a dataset using the Tags input element I’ll appreciated.

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/a/7a48eba9fa9cfa90d9ebd398ba2f746b6b69b10f.png)  
This is the code I’m using to Display these tags (Different from what I am working on)  
$w . onReady ( function () {  
let tags = $w ( “#dynamicDataset” ). getCurrentItem (). tags ;  
let tagsHtml = tags . map ( tag =\>  
`<span style="background: #ff0000; border-radius: 5px; line-height: 2.6; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; margin-left: 0px; margin-right: 0px; text-align: center; color: #ffffff; font-weight: 700; font-size: 12px"> ${ tag } </span>` )  
. join ( ’ ’ );  
$w ( ‘#displayTags’ ). html = tagsHtml ;  
});
