[Solved] "_ID" field in my database, for what?

Dear experts, I have a connection to 123forms and every time a form is filled out, my database shows 2 same entries, but with a different _id?

Wonder where the reason is, wix or 123forms? :worried:

Thanks
Yulia

You should contact the author of 123Forms for support.

Dear Yisrael,

Support says it’s because of this code. I have requested a redirect to a “thank you” page from the third party provider and they are running this code and they think it is because of this:

Can this be?

import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;

$w.onReady( function () {

let path = wixLocation.path;
let query = wixLocation.query;
let collectionName = ‘123FormBuilder_12345678’ ;

if ( “collection” in query) { collectionName = query[ ‘collection’ ]; }
if ( “data” in query) {
let obj = JSON.parse(atob(query[ ‘data’ ]));

console.log( ‘Sending 123FormBuilder submitted data to WixCode’ );

wixData.insert(collectionName, obj); }

else {

console.log( ‘No submission data received from 123FormBuilder’ ); } });

Thanks for your help
Best regadrs,
Yulia

I suspect it’s because the code in the onReady() function is being run twice - once in server side, and the second time client side.

See the article Preventing Unwanted Side Effects for an explanation. As you can see in the article, you should wrap your code inside a check for rendering in the browser. Something like this:

$w.onReady(function () {
   if (wixWindow.rendering.env === "browser") {
      // put your code here
   }
});

That was the issue - Solved !!! Thank you

Glad I could help.