this is a typical example of how you would pass a comment to your database when on your dynamic page.
import wixUsers from “wix-users”;
$w.onReady( function () {
//place a submit 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()
})
})
})
})