Wix Data works in Preview but not in Publish Mode

So I was trying to insert data from User Input into my database using corvid, which works perfectly in Preview mode, but not on the published site.
I tried to set my dataset to read only and sync everything to live, but it doesnt work.


export function btnAdd_click(event) {
 let newEntry = {
        title: $w('#iStockTitle').text,
        memberName: $w('#iName').value,
        investment: parseFloat($w('#iInvestment').value)
    };
    wixData.insert("tempData", newEntry);
    $w('#dataset2').refresh();
}

So if somebody knows another way how to do it or knows a solution to that problem, please let me know!

Check if your database is in sandbox mode!
I think if it’s in sandbox mode, the data will not appear in publish mode

Hey Melia!
Thank you for the answer. What exactly do you mean with sandbox mode? where can I change it to live?


because when I toggle it here to live, it switches automatically back to sandbox when I close it…

Update: I solved the problem. Had to change permissions for the database.

Yay! good job

But the refresh still doesnt work. I have to reload the whole page to see the updated database entry. any suggestions? :slight_smile:

Hi I am having the same issue. I have simple code that sums the value in a column. In preview mode the sum of the values in table add up correctly. In publish mode the values i get a different value that doesn’t match the preview mode (which contains the correct value). Any idea what is going on. I checked permissions and i have synced my database. Still not working.

Not sure this is the “same issue”. You will need to provide more information. Explain what you are trying to do, what works, and what doesn’t. What does your database collection look like? Also, add any code in a code block as stated in the Forum Guidelines .