# collect and display User-Generated Content

**URL:** <https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [June 11, 2018, 1:46pm UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956 "2018-06-11T13:46:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![service2-customer](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/service2-customer/32/2436_2.png) [@service2-customer](https://forum.wixstudio.com/u/service2-customer)\
**Post date:** [June 11, 2018, 1:46pm UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/1 "2018-06-11T13:46:01Z")

</div>

Hi,  
I follow the youtube viedo to setup the collect and display User-Generated Content on my dynamic Website. However, it does not work and much appreciate on your help. Thanks!  
here is my coding and the setting dynamic page  
db name: comment  
field: 1.title 2.comments

![](https://us1.discourse-cdn.com/wix/original/3X/3/c/3ca9c55147eeb11abd46910b53fbdaa9d593b608.png)

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

---

<div class="post-metadata">

**Author:** ![itai-pelles](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/itai-pelles/32/669_2.png) [@itai-pelles](https://forum.wixstudio.com/u/itai-pelles)\
**Post date:** [June 12, 2018, 9:58am UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/2 "2018-06-12T09:58:51Z")

</div>

Hey,

Can you please share a link to your page?  
I’m not sure i understand your current configuration.

Thanks,  
Itai

---

<div class="post-metadata">

**Author:** ![service2-customer](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/service2-customer/32/2436_2.png) [@service2-customer](https://forum.wixstudio.com/u/service2-customer)\
**Post date:** [June 12, 2018, 11:29am UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/3 "2018-06-12T11:29:58Z")

</div>

HI Itai,  
Here is the dynamic page  
[greatinfohk.com/agentprofile/aci](http://greatinfohk.com/agentprofile/aci)

---

<div class="post-metadata">

**Author:** ![itai-pelles](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/itai-pelles/32/669_2.png) [@itai-pelles](https://forum.wixstudio.com/u/itai-pelles)\
**Post date:** [June 12, 2018, 3:24pm UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/4 "2018-06-12T15:24:54Z")

</div>

Hi,

Actually, when using datasets, there’s no need for code at all, you can remove that code.  
If you want on submit, to let the user see it’s latest comment, you can leave a bit of code, something like that:

```javascript
$w("#commentsWrite").onAfterSave(() => {
    $w("#commentsRead").refresh();
});

```

If it’s still not working, please describe what exactly is not working 🙂

Good Luck,  
Itai

---

<div class="post-metadata">

**Author:** ![service2-customer](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/service2-customer/32/2436_2.png) [@service2-customer](https://forum.wixstudio.com/u/service2-customer)\
**Post date:** [June 13, 2018, 2:47am UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/5 "2018-06-13T02:47:27Z")

</div>

Hi Itai,  
Still not working following your idea and there is no error message. I suppose when someone leave message, the message will be stored in the database, and also the message will be displayed on page accordingly.

I’m following this video to setup

[![](https://us1.discourse-cdn.com/wix/original/3X/e/c/ecb826cc3452f010223c40b5145d2feb95e256b4.jpeg "Wix Code | How to Collect & Display User-Generated Content on Your Website") ](https://www.youtube.com/watch?v=fF4AsWH1diQ&t=3s)

---

<div class="post-metadata">

**Author:** ![neilstansfield8](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@neilstansfield8](https://forum.wixstudio.com/u/neilstansfield8)\
**Post date:** [September 23, 2018, 8:54pm UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/6 "2018-09-23T20:54:58Z")

</div>

Hi did you ever solve your problem. I’m struggling with the above also. Thanks.

---

<div class="post-metadata">

**Author:** ![michelepotvin](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/michelepotvin/32/18145_2.png) [@michelepotvin](https://forum.wixstudio.com/u/michelepotvin)\
**Post date:** [April 12, 2020, 4:18pm UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/7 "2020-04-12T16:18:58Z")

</div>

I am using the same code, the data displays on preview but not on the web. Can you help me please.  
**import** wixData **from** ‘wix-data’;  
**function** getdata(){  
**let** query = wixData.query(‘HabitatAbordable’);  
**return** query.limit(200).find().then(results =\> {  
console.log(‘getData’, results);  
**return** results.items;  
});  
}  
$w.onReady( () =\> {  
$w(‘#habitatwrite’).onAfterSave( () =\> {  
getdata().then ((items) =\> {  
$w(‘#habitatlist’).data = items;  
});  
});  
//TODO: write your page related code here…  
// Gets today’s date  
**const** today = **new** Date();  
// Sets the property of the text element to be a string representing today’s date in the user’s local format  
$w(“#dateText”).text = today.toLocaleDateString();  
**let** count = $w(“#habitatread”).getTotalCount();  
});

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [April 12, 2020, 4:46pm UTC](https://forum.wixstudio.com/t/collect-and-display-user-generated-content/37956/8 "2020-04-12T16:46:13Z")

</div>

Please post a new post rather than bumping up an old thread from 2018 with a link to refer back to this post if needed.

The issue you have got with it working in preview and not in live is that you may have not synced your datasets.  
[https://support.wix.com/en/article/syncing-data-between-sandbox-and-live-database-collections](https://support.wix.com/en/article/syncing-data-between-sandbox-and-live-database-collections)

You can also watch the original Wix YouTube video to understand the code and how it is used as well.  
[Corvid by Wix | How to Collect & Display User-Generated Content on Your Website](https://www.youtube.com/watch?v=FVARVy3YS74&list=PL0y_aclKYoYhzHA9TbgEhzU68bvRI15mI&index=6)  
_Watch how you can collect and display user-generated content as comments on your website. In this video, you’ll learn how to create a database to store and manage visitor comments. Then, add user input elements to collect visitor reviews and a repeater element to display them. Finally, see how your repeater automatically updates with visitor reviews, displaying content from your database._
