Why am I getting this error in the collection?
My code:
let weekHourArray = [
{mondayMorningOpen: "morningOpen", mondayMorningClose: "morningClose", mondayAfternoonOpen: "afternoonClose", mondayAfternoonClose: "afternoonClose"},
{tuesdayMorningOpen: "morningOpen", tuesdayClose: "morningClose", tuesdayAfternoonOpen: "afternoonClose", tuesdayAfternoonClose: "afternoonClose"},
{weddayMorningOpen: "morningOpen", weddayMorningClose: "morningClose", weddayAfternoonOpen: "afternoonClose", weddayAfternoonClose: "afternoonClose"},
{thursdayMorningOpen: "morningOpen", thursdayMorningClose: "morningClose", thursdayAfternoonOpen: "afternoonClose", thursdayAfternoonClose: "afternoonClose"},
{fridayMorningOpen: "morningOpen", fridayMorningClose: "morningClose", fridayAfternoonOpen: "afternoonClose", fridayAfternoonClose: "afternoonClose"},
{satdayMorningOpen: "morningOpen", satdayMorningClose: "morningClose", satdayAfternoonOpen: "afternoonClose", satdayAfternoonClose: "afternoonClose"},
{sundayMorningOpen: "morningOpen", sundayMorningClose: "morningClose", sundayAfternoonOpen: "afternoonClose", sundayAfternoonClose: "afternoonClose"},
]
export function openingsHoursSaveButton_click(event) {
$w("#datiNegozioDataset").onReady( () => {
$w("#datiNegozioDataset").setFieldValue("openingsHours", weekHourArray);
$w("#datiNegozioDataset").save()
console.log("Saved")
});
}
Any suggestions? Thanks in advance!
Checked all database-permissions?
Perhaps this one? (NOT TESTED!)
$w.onReady(function () { $w('#button1').onClick(()=>{ $w("#dataset1").onReady(() => { let weekHourArray = [ {mondayMorningOpen: "morningOpen", mondayMorningClose: "morningClose", mondayAfternoonOpen: "afternoonClose", mondayAfternoonClose: "afternoonClose"}, {tuesdayMorningOpen: "morningOpen", tuesdayClose: "morningClose", tuesdayAfternoonOpen: "afternoonClose", tuesdayAfternoonClose: "afternoonClose"}, {weddayMorningOpen: "morningOpen", weddayMorningClose: "morningClose", weddayAfternoonOpen: "afternoonClose", weddayAfternoonClose: "afternoonClose"}, {thursdayMorningOpen: "morningOpen", thursdayMorningClose: "morningClose", thursdayAfternoonOpen: "afternoonClose", thursdayAfternoonClose: "afternoonClose"}, {fridayMorningOpen: "morningOpen", fridayMorningClose: "morningClose", fridayAfternoonOpen: "afternoonClose", fridayAfternoonClose: "afternoonClose"}, {satdayMorningOpen: "morningOpen", satdayMorningClose: "morningClose", satdayAfternoonOpen: "afternoonClose", satdayAfternoonClose: "afternoonClose"}, {sundayMorningOpen: "morningOpen", sundayMorningClose: "morningClose", sundayAfternoonOpen: "afternoonClose", sundayAfternoonClose: "afternoonClose"}, ] $w("#dataset1").setFieldValue("openingsHours", weekHourArray); $w("#dataset1").save() console.log("Saved") }) }) })