HELP ! Submitting data no longer works !

Hello,

So I have this comment box on a dynamic page, everything used to work just fine, users could post a comment along with the nickname of their choice, only now it no longer works !

It shows the message error everytime I try to post something.

I’ve already checked permissions, everything is set on “everyone”.

Here is my code :

$w("#dataset3").onReady(() => {
		const msg = $w("#dataset3").getCurrentItem();
		$w("#html1").onMessage((event) => {
			if (event.data === "ready") {
				$w("#html1").postMessage(msg.longDescription);
			}
		
			//Set the value for the rich text field of the dataset's 
			//current item to be the data in the HTML element
			const dataWithFixedLinkStyles = event.data.replace(/\<a/g, `<a style="color:#F78E05;"`);
 			
 			$w('#dataset3').setFieldValue("commentRich", dataWithFixedLinkStyles);
				$w("#repeater2").onItemReady(($w, itemData, index) => {
				$w('#dataset3').setFieldValue('item', $w('#text54').text);
				});
	 		let url = wixLocation.url;
			$w('#dataset3').setFieldValue('url', url);
			$w('#dataset3').setFieldValue('reference', $w('#input2').value)
				.then((res) => {
				
					$w("#dataset3").save()
						.then(() => {
							wixLocation.to(wixLocation.url);
						
						});
					});
	
		});
	
	});
	
	
	
//refreshes comments + goes to top of comment box upon submitting a message
export function button43_click(event, $w) {
	
	
	
	//POST A COMMENT
	//post a comment and get the item's ID + title + URL

		$w("#html1").postMessage("save");
}

I use the CKeditor, it works fine on 2 other pages, but on this page it doesn’t work anymore.

CKeditor code in HTML component:

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">   
    <script src="//cdn.ckeditor.com/4.6.2/basic/ckeditor.js"></script>  
    <script type="text/javascript">
     function init() {       
         window.onmessage = (event) => {  
         if (event.data == "save") {
            window.parent.postMessage(CKEDITOR.instances.CK1.getData(),"*"); 
         } else {
            CKEDITOR.instances.CK1.setData(event.data);
            window.parent.postMessage("set","*");
         }
       }
     }
     </script>
  </head>
  <body onload="init();">
    <textarea placeholder ="test" name="editor1" id="CK1"></textarea> 
    <script>
        CKEDITOR.replace("editor1"); 
        window.parent.postMessage("ready", "*");
    </script>
  </body>
</html>

Link to the page :

Please help me as this is of the utmost importance for my website !

Hi Tristan,

Are there any console errors?

No there isn’t :frowning:

Actually, if I click the ‘post’ button repeatedly, it shows this :

Wix code SDK error: The “onItemReady” function of “repeater2” threw the following error: Operation (inScope) not allowed during save

Hi,

Try opening the browser’s console (F12 or CMD + Option + I in mac)

I tried as you said (on the published version) and it showed this :

es6runtime.min.js:6 Uncaught (in promise) Error: The commentaires collection does not exist. You cannot work with a collection using the Data API before it is created in the Editor.

From what I understand, the collection appears to be inexistant, however I did publish the website, synchronized the collection to the live version, and the collection is visible in the live database.

Oddly, when I tried to post a comment on the published version, only the nickname entry appeared in the sandbox collection, not the comment nor any other data linked to it (item, reference)

bump

Hello Tristan,

I tried submitting a comment in this page and it appears to be working as expected.
https://www.wehaveadeal.net/deals/1525090151

I can also see it in the live collection:

Did you do anything to solve the issue?
Thanks.
Ido

Yes now it seems to be back in order for some reasons.

Thanks.