Hello and thank you in advance for any help! : -)
The Situation:
Search for a record —> the result data populates a form —> user can update the data in the form —> click UPDATE button —> record in the collection is updated.
Problem: update call not updating the record in the collection.
I have checked the permissions: for the dataset on the page = Read/Write and for the collection itself: ANYONE
Also, regarding the QUERY that precedes the update call (in the code below) - there is only one possible match in the collection.
I have hard-coded a few of the fields for testing purposes . Otherwise, all the update data is coming off the form fields.
Here is the OnClick Event code for the Update Button:
// UPDATE record with form contents
export function UpdateClick(event) {
const options = {
"suppressAuth": true,
"suppressHooks": true,
};
wixData.query("moment-practitioners")
.eq("naam", origSrchNaam) // find the record to update based on the ORIG search
.eq("postcode", origSrchPostcode) // criteria - user may have updated these fields
.find()
.then( (results) => {
if(results.items.length > 0) {
let item = results.items[0];
$w("#iNaam").value = item.naam; // updated naam
$w("#iVoornaam").value = item.voornaam; // updated voornaam
$w("#iWebsite").value = item.website; // updated email
$w("#iEmail").value = item.website; // updated website
$w("#iGemeente").value = item.gemeente; // updated gemeente
$w("#iPostcode").value = item.postcode; // updated postcode
$w("#iProvincie").value = item.provincie; // updated provincie
$w("#iTel1").value = item.tel1; // updated tel 1
$w("#iTel2").value = item.tel2; // updated tel 2
$w("#iTxt1").value = item.beroepsactiviteit; // updated beroepsactiviteit
$w("#iTxt2").value = item.contexten; // updated contexten
$w("#iTxt3").value = item.specialisatie; // updated specialisatie
$w("#iTxt5").value = item.bijscholing; // updated bijscholing
$w("#iTxt6").value = item.mindfulnessBestaatUit; // updated bestaat
$w("#iTxt7").value = item.trajectOmMindfulnessTrainer; // updated traject
$w("#iTxt8").value = item.ervaring; // updated ervaring
$w("#iTxt4").value = item.opleiding; // updated opleiding
hiddenID = item._ID;
hiddenFoto = item.foto;
} else {
// handle case where no matching items found
// DISPLAY no match text on screen
$w("#tNoMatchMsg").show();
}
} )
.catch( (err) => {
let errorMsg = err;
} );
}
This is the actual page
IF YOU TEST THIS, please select ANDROS & postcode 1000 in the search criteria at the top: https://www.mindfulmoment.be/practitioner-edit
Thank you again! : -) Cynthia-