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
Hey,
Can you please share a link to your page?
I’m not sure i understand your current configuration.
Thanks,
Itai
HI Itai,
Here is the dynamic page
greatinfohk.com/agentprofile/aci
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:
$w("#commentsWrite").onAfterSave(() => {
$w("#commentsRead").refresh();
});
If it’s still not working, please describe what exactly is not working
Good Luck,
Itai
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
Hi did you ever solve your problem. I’m struggling with the above also. Thanks.
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();
});
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
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
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.