hi
i have a dataset and in a lightbox i get 1 field i need to update in a record.
this is the part in my code im doing that and it is not working.
$w(‘#dataset1’).setFilter(
wixData.filter()
.eq(‘_id’, $w(‘#text15’).text)
)
.then(() => {
$w(“#text13”).show();
$w(“#text13”).text=$w(“#dataset1”).getCurrentItem().datesupplied;
$w(“#dataset1”).setFieldValue(“datesupplied”, ds); //NOT SAVING!!
$w(“#text13”).text=$w(“#text13”).text+" || " + $w(“#dataset1”).getCurrentItem().datesupplied;
$w(“#dataset1”).save().then($w(“#text12”).text=“saved”);
});
i get in TEXT12 the word SAVED, and in TEXT13 i get: ’ || 10.1.2019 12:00:00AM
which means the data is there, it just not saved !!
why?
1 Like
try move $w(" #dataset1 ").save() to the next line under setFieldValue
It was there in the begining. Because it didnt work i added the rest just to verify and debug.
ds is variable? is it defined?
yes. It is a string and also datesupplied is a string.
Btw same thing happends even if i replace ds with “123”
Its not saved.
The permissions for the dataset are given all to site members and a site member is logged on.
Maybe i can use a different aproatch that will get the current item, change the value in datesupplied and replace the whole record?
try with console.log at each line and You will see where is mistake
check if filter workes first. write res after then and check res. if so go further and further checking each line and You will find out
try also to set field value “123” only with save without rest and You will see if saves
Do I work on something similar, does anyone have any solution?
first of all, Thanks
Repost your question and explain exactly what it is you’re trying to do.