Hi I am submitting data to a collection (with a rich text editor) and I have a .gif file I want to show that says ‘saving’ as soon as you press submit. However, when I put it in the code eg. $w(“#group24”).show(); to show this element I have to press submit twice to save the information??
SITE URL: book-the-best
Code:
import wixWindow from ‘wix-window’;
import wixData from ‘wix-data’;
export function submit_click(event, $w) {
$w(“#group24”).show();
//Send a blank message to the HTML element. This tells the HTML
//element you want it to send you its contents
$w(“#html1”).postMessage(" “);
//Receive the message from the HTML element
$w(”#html1").onMessage((event) => {
//Set the value for the rich text field of the dataset’s
//current item to be the data in the HTML element
$w(“#dataset2”).setFieldValue(“longDescription”, event.data);
//Submit the current item of the dataset
$w(“#dataset2”).save()
.then((res) => {
console.log(“saving”, res);
$w(“#group24”).show();
setTimeout(function(){$w(“#group24”).hide(); }, 2100);
wixWindow.openLightbox(‘SAVED’)
.then((data) => {
$w(“#html1”).postMessage(“x”, data);
});
$w(“#PropertyInfo”).value = null;
$w(“#Location”).selectedIndex = undefined;
});
});
}