Hello,
I looked through some of the past forum posts and couldn’t find the solution that I was looking for.
I was able to create a unique comment box for my dynamic wix pages using a repeater and linking it to a database. I would like for the comments to display right after the user clicks the “Submit Comment” Button. Right now the comments will only display after the page is refreshed. Is there a way to have a live comment update without having to refresh/reload the entire page?
The code that I am using is below – please let me know if more information is needed.
Thank you!
import wixData from 'wix-data';
let dynamicPageItem;
$w.onReady(() => {
$w('#button1').onClick(saveComment);
});
function saveComment(event) {
dynamicPageItem = $w('#dynamicDataset').getCurrentItem().title;
if ($w('#textBox1').value.length > 0) {
$w('#dataset1').setFieldValue('dynamicPageItem',
(dynamicPageItem));
$w('#dataset1').setFieldValue('comment',
$w('#textBox1').value);
$w('#dataset1').save();
}
}