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?
Thanks
Yulia
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?
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.