How to remove all data from an field? (Solved)

Hello, I’m trying to create a custom members page where people can submit their own background and it will show on their page as the background. I got that to work perfectly now I’m just having problems with a feature that can remove the current background. So basically remove all data from a field.

You need to update() the member’s data. You need to retrieve the user’s record, clear the background field, and then update() the record. Something like this:

wixData.get("Members", <member's id>)
.then((toUpdate) => {
   toUpdate.background = null; // clear background field
   wixData.update("Members", toUpdate)
   .then((res) => {
      console.log(res);
   })
   .catch((err) => {
      let errorMsg = err;
   });
})
.catch((err) => {
   let errorMsg = err;
});

I hope this helps,

Yisrael

Thanks so much! That worked perfectly :slight_smile: