Hi Guys,
I need your advice - how can i add comments functions to my repeaters ?
I’ve tried to add disqus but in this case comment for one my item replicated to all other and that’s differently what i’m looking for. I wont to have a separate comment trad for each item.
I’m not exactly sure what the problem is. Why not just add a text input field to the repeater item? This will then be applied to only that repeater item.
If I missed the point let me know what it is your’re trying to accomplish.
//place a post comment button on the page and call it commentButton1
$w('#commentButton1').onClick(function () {
//dataset1 is connected to your collection where you store the original post
let orininalPostId = $item("#dataset1").getCurrentItem()._id;
//dataset2 is connected to your collection where you store the comments, make sure you have set read/write access to dataset2
$w("#dataset2").onReady(() => {
let user = wixUsers.currentUser;
//get userEmail so that it can be passed to the comments database that way we know who made the comment
user.getEmail()
.then((email) => {
let currentUserEmail = email;
//create columns in your comments database and name them orininalPostId, comment, userEmail. Place an comment input box on the page and call it commentInputBox1
//now we save the comment to the database
$w('#dataset2').setFieldValue('orininalPostId', (orininalPostId));
$w('#dataset2').setFieldValue('comment', $w('#commentInputBox1').value);
$w('#dataset2').setFieldValue('userEmail', (currentUserEmail));
$w('#dataset2').save()
})
})
})
If you add a text input field to the repeater of course you add a comment there , but it gets repeated in all items in the dynamic page, how to solve it?