firstly bro…thanks for such a detail description… i tried dumbing it down by removing the get dataset1 info, but when i click the button, nothing happens. i would have though at the very least when i clicked it, the user email and comment would go into dataset two
import wixUsers from “wix-users”;
import wixData from ‘wix-data’;
$w.onReady( function () {
//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()
})
})
})
})