# Database tags

**URL:** <https://forum.wixstudio.com/t/database-tags/19360>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [May 22, 2019, 5:48pm UTC](https://forum.wixstudio.com/t/database-tags/19360 "2019-05-22T17:48:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![whitneybt](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/whitneybt/32/8836_2.png) [@whitneybt](https://forum.wixstudio.com/u/whitneybt)\
**Post date:** [May 22, 2019, 5:48pm UTC](https://forum.wixstudio.com/t/database-tags/19360/1 "2019-05-22T17:48:41Z")

</div>

I created a user input form that uses the multiple selector check boxes. This can only be saved as tags in the database.

I want to display the checked values on a dynamic page, but no element will let me chose tags as the connected data. Any suggestions?

---

<div class="post-metadata">

**Author:** ![mittalcauvery18](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mittalcauvery18/32/12869_2.png) [@mittalcauvery18](https://forum.wixstudio.com/u/mittalcauvery18)\
**Post date:** [June 25, 2019, 9:59am UTC](https://forum.wixstudio.com/t/database-tags/19360/2 "2019-06-25T09:59:12Z")

</div>

@corvidcode - I have the same query. Kindly guide

---

<div class="post-metadata">

**Author:** ![admin-23](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/admin-23/32/708_2.png) [@admin-23](https://forum.wixstudio.com/u/admin-23)\
**Post date:** [June 25, 2019, 1:04pm UTC](https://forum.wixstudio.com/t/database-tags/19360/3 "2019-06-25T13:04:13Z")

</div>

Hi,

You can display the data using the same Multiple selection element.

---

<div class="post-metadata">

**Author:** ![sedmondsonwork](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/sedmondsonwork/32/10039_2.png) [@sedmondsonwork](https://forum.wixstudio.com/u/sedmondsonwork)\
**Post date:** [August 16, 2019, 5:49pm UTC](https://forum.wixstudio.com/t/database-tags/19360/4 "2019-08-16T17:49:14Z")

</div>

I’d like to bump this query.

I also have a data input form, using checkbox groups. This saves data of the field type “tags” but there are no UI elements (i.e. display elements, NOT input elements) which display tag field types, as far as I can see. This limits the way we can enter data using forms which are intended for display in dynamic pages.

What is the best way to display data in a dyamic page which has been saved as field type tags? Seems weird to force the data type to something which has no associated UI display elements.

Also, it looks like dataset filters do not support tags field types either!! aaargh!

---

<div class="post-metadata">

**Author:** ![jeyda](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jeyda/32/14088_2.png) [@jeyda](https://forum.wixstudio.com/u/jeyda)\
**Post date:** [August 21, 2019, 1:32pm UTC](https://forum.wixstudio.com/t/database-tags/19360/5 "2019-08-21T13:32:36Z")

</div>

Agree - I want to be able to get the admin user to suggest a bunch of options which get sent to the user on a dynamic page who can then select which of the options they want but that doesn’t seem to work…

---

<div class="post-metadata">

**Author:** ![yoav-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yoav-wix/32/674_2.png) [@yoav-wix](https://forum.wixstudio.com/u/yoav-wix)\
**Post date:** [August 21, 2019, 1:53pm UTC](https://forum.wixstudio.com/t/database-tags/19360/6 "2019-08-21T13:53:48Z")

</div>

You can do that, using a bit of code.

Here is an example repeater which shows tags -

 ![](https://us1.discourse-cdn.com/wix/original/3X/d/a/da49ccd3081bdf3f52b51ffa726dc8df396d4223.jpeg)  
In the content manager, this looks like the following -

 ![](https://us1.discourse-cdn.com/wix/original/3X/f/6/f6f423c0202746baf18bf1f54b4938b2e2d6f04f.png)  
What I have done was to write a little code in the repeater onItemReady event, to read the tags field and format it as an HTML for showing the tags. Here is the actual code I have used -

```javascript
export function repeater2_itemReady($item, itemData, index) {
 let tags = itemData.tags;
 let tagsHtml = tags.map(tag => 
      `<span style="background: #459fed; 
        border-radius: 5px; 
        padding: 0 3px; 
        color: #fff; 
        font-size: 12px">${tag}</span>`)
      .join(' ');
    $item('#tags').html = tagsHtml;
}

```

First, I read the tags field value from the itemData - which is the current item in the repeater this event is called for.

Then, using the fact that tags are just an array of string, using the map function I transform each tag value into an HTML that renders the tag - using a span element with the right CSS.

Using the Join function I turn it all into a single HTML string, which I then set to the tags text element.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![sedmondsonwork](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/sedmondsonwork/32/10039_2.png) [@sedmondsonwork](https://forum.wixstudio.com/u/sedmondsonwork)\
**Post date:** [August 21, 2019, 2:20pm UTC](https://forum.wixstudio.com/t/database-tags/19360/7 "2019-08-21T14:20:24Z")

</div>

Hey Yoav, thanks very much for the reply - this is a really nice bit of html and I’m going to try and use it to render a tag area on my items.

Additionally, I was finding it hard to add filters to a page dataset because filtering tags isn’t possible. So, therefore, for these fields, I have found it necessary to use an array.join() script so that my filters and searches can work.

for example:

```javascript
export function checkboxCategory_change(event) {
 let str = event.target.value.join(", ");
    $w('#dataset1').setFieldValue('category', str);
}

```

If I wanted to render the tags in addition to searching, I would create a new searchable field (text) to the database and then use the original tag field array for rendering as you have done.

I appreciate you taking the time to reply and provide a fab example. Cheers.

---

<div class="post-metadata">

**Author:** ![yoav-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yoav-wix/32/674_2.png) [@yoav-wix](https://forum.wixstudio.com/u/yoav-wix)\
**Post date:** [August 21, 2019, 6:37pm UTC](https://forum.wixstudio.com/t/database-tags/19360/8 "2019-08-21T18:37:31Z")

</div>

Hey @sedmondsonwork , Best if you ask a second question to ask it as a new topic.  
That way, when someone else has a similar need, they can find the right thread.

Send me the new topic URL on the chat here, will try to help.

---

<div class="post-metadata">

**Author:** ![dbrum101](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/dbrum101/32/5857_2.png) [@dbrum101](https://forum.wixstudio.com/u/dbrum101)\
**Post date:** [August 22, 2019, 4:25pm UTC](https://forum.wixstudio.com/t/database-tags/19360/9 "2019-08-22T16:25:54Z")

</div>

Hi @yoav-wix - I have a very similar need to the solution you showed above to manually add the tags to a repeater component. See screenshot of my repeater - I have all my columns mapped to the dataset, but there is a column not mapping called ‘programdays’ defined as a Tags data type.  
What are the steps I need to use your code in my scenario?  
I guess I need to add an empty, unmapped column to my repeater? I can’t seem to find how to do this.  
Then, where is the itemReady() callback defined? When I look at the properties of my repeater, I do not see this event callback listed to add my own code.

thanks

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/0/70eca141d7c728fdbc1a5aa52ae3d0960c9646e3.png)

---

<div class="post-metadata">

**Author:** ![tungoslo8](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/tungoslo8/32/14231_2.png) [@tungoslo8](https://forum.wixstudio.com/u/tungoslo8)\
**Post date:** [November 22, 2019, 5:47am UTC](https://forum.wixstudio.com/t/database-tags/19360/10 "2019-11-22T05:47:19Z")

</div>

Hi @yoav-wix , thanks for instruction, could you pls give a bit more detail about how to add the code?

Best,

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [December 2, 2019, 4:10am UTC](https://forum.wixstudio.com/t/database-tags/19360/11 "2019-12-02T04:10:43Z")

</div>

Hi Yoav,

I added your code and followed the steps very carefully, even for a couple of hours to try and debug, but it would **NOT** work for me. Can you elaborate? I used the amended version for dynamic page:

```javascript
$w('#dynamicDataset').onReady(() => {
 let currentProject = $w('#dynamicDataset').getCurrentItem();
 let tags = currentProject.projectTags;
 let tagsHtml = tags.map(tag =>
                `<span style="background: #459fed; 
        border-radius: 5px; 
        padding: 0 3px; 
        color: #fff; 
        font-size: 15px">${tag}</span>`)
            .join(' ');
        $w('#text27').html = tagsHtml;
        $w('#text27').show();
    });

```

---

<div class="post-metadata">

**Author:** ![jeff17](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jeff17/32/4963_2.png) [@jeff17](https://forum.wixstudio.com/u/jeff17)\
**Post date:** [January 3, 2020, 5:05am UTC](https://forum.wixstudio.com/t/database-tags/19360/12 "2020-01-03T05:05:13Z")

</div>

You made a mistake in your code.

Remove the quotation marks after the 12px where it says fontsize, and add a semi-colon.

This will then allow the css to execute the font size, and render the item.

It should read - fontsize: 12px; \>${tag}'}

export function repeater1\_itemReady($item, itemData, index) {  
**let** tags = itemData.tags;  
**let** tagsHtml = tags.map(tag =\>  
`<span style="background: #459fed; border-radius: 5px; padding: 0 3px; color: #fff; font-size: 12px>${tag}</span>`)  
.join(’ ‘);  
$item(’#text232’).html = tagsHtml;  
}

---

<div class="post-metadata">

**Author:** ![adas-bradauskas](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/adas-bradauskas/32/669_2.png) [@adas-bradauskas](https://forum.wixstudio.com/u/adas-bradauskas)\
**Post date:** [January 3, 2020, 8:07am UTC](https://forum.wixstudio.com/t/database-tags/19360/13 "2020-01-03T08:07:53Z")

</div>

Half a year late to the party, but you can now connect Tags to Text component. It shows tags as comma separated values. Hope that helps!

---

<div class="post-metadata">

**Author:** ![florencemunrobrown](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/florencemunrobrown/32/16864_2.png) [@florencemunrobrown](https://forum.wixstudio.com/u/florencemunrobrown)\
**Post date:** [January 22, 2020, 11:12pm UTC](https://forum.wixstudio.com/t/database-tags/19360/14 "2020-01-22T23:12:08Z")

</div>

Hi @yoav-wix , I want to display tags on my repeater exactly as you’ve shown in your example.

I’ve tried pasting your code into the PAGE CODE but I’m not seeing any changes.

I updated itemData to be the Field key which is “operatorTypes”. Are there any other changes I need to make? I’m pasting the code in the console after “//TODO: write your page related code here…”

 ![](https://us1.discourse-cdn.com/wix/original/3X/7/d/7d8e16706683d4af4a93ebfe418f0c4febf03dfc.jpeg)

---

<div class="post-metadata">

**Author:** ![Shan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/shan/32/106059_2.png) [@Shan](https://forum.wixstudio.com/u/Shan)\
**Post date:** [January 22, 2020, 11:15pm UTC](https://forum.wixstudio.com/t/database-tags/19360/15 "2020-01-22T23:15:28Z")

</div>

@florencemunrobrown Please make a new post instead. Follow our [community guidelines](https://www.wix.com/corvid/forum/community-discussion/corvid-community-guidelines) .

---

<div class="post-metadata">

**Author:** ![Shan](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/shan/32/106059_2.png) [@Shan](https://forum.wixstudio.com/u/Shan)\
**Post date:** [January 22, 2020, 11:18pm UTC](https://forum.wixstudio.com/t/database-tags/19360/16 "2020-01-22T23:18:11Z")

</div>

[Yoav’s code](https://www.wix.com/corvid/forum/main/comment/5d5d4cec16b059001670ef03) is a working example of how to display tags from the database and as [Adas says](https://www.wix.com/corvid/forum/main/comment/5e0ef659fb854800b025b5c5) , you can now connect tags to the Text component.

Since 2 solutions have been laid out above I am closing this thread to avoid unnecessary bumps. If anyone has an issue regarding database tags please open a new thread while following our [Community Guidelines](https://www.wix.com/corvid/forum/community-discussion/corvid-community-guidelines) .
