Saving in Sandbox but not Live

I seem to be having a strange issue where I can save to my sandbox environment in preview but not on my live site.

I’ve published the site and have been inputting data into a form on my live site when I click the button to save. The data doesn’t save on my live DB. But when I go into preview mode and input the same data and the same process. It saves in the sandbox DB.

This happened around the same time I was going back to a previous version of my site. I’ve since deleted my DB, created a new one updated the fields and elements. Made sure my elements were pulling back values and connected to the DB but still to no avail. I keep submitting my data on my live site but my live DB is empty.

export function CalculateButton_click(event) {
let Reg = {
“FirstName”: $w(“#FirstName”).value,
“LastName”: $w(“#LastName”).value,
“Email”: $w(“#Email”).value,
“Phone”: $w(“#Phone”).value,
“PostCode”: $w(“#PostCode”).value,
“Usage”: $w(“#Usage”).value,
“Direction”: $w(“#Direction”).value,
“Bill”: $w(“#Bill”).value
};

let bill = $w(“#Bill”).value;
let postCode = $w(“#PostCode”).value;

session.setItem(‘BillData’, bill);
session.setItem(‘PostCode’, postCode);

let req1 = $w(“#FirstName”).valid;
let req2 = $w(“#LastName”).valid;
let req3 = $w(“#Email”).valid;
let req4 = $w(“#Phone”).valid;

if (req1 === false || req2 === false || req3 === false || req4 === false ) {
console.log(Reg);
console.log(“Fail”);
} else {
console.log(“Pass”);
CalculateField();
$w(‘#slideshow1’).changeSlide(2);
$w(‘#group1’).expand();
wixData.save(“SolarLeading”, Reg);
}
}


When you work in the Wix Editor you are working in the sandbox version, when you publish your website then the user is using the live version. So you need to sync your sandbox version to your live version if you have data that you want moved etc.

https://support.wix.com/en/article/accessing-your-sandbox-and-live-database-collections
https://support.wix.com/en/article/syncing-data-between-sandbox-and-live-database-collections

Sorry, I should of clarified.
I’ve published the site and have been inputting data into a form on my live site when I click the button to save. The data doesn’t save on my live DB. But when I go into preview mode and input the same data and the same process. It saves in the sandbox DB.
Just wondering if there’s a few quirks of Wix I don’t know about?

@brookmorpeth Check the collection permissions. Maybe it’s set so only an Admin can write to it (then change the permission to whatever you want).

@jonatandor35 Thank You