datefield doesnot register set value from code

I set a datepicker value from code. Inside the datepicker, the date changes visually and correctly. But it wouldnot save to collection. I checked all collection and dataset permissions.
The onBeforeSave is triggered, but no Save() is performed, no onAfterSave is raised. Also, the onItemValuesChanged is not raised when I set the datepicker.value .
In short, it looks like Wix Code doesnot register the change in datepicker thru code, thus save() is not performed. How do I solve this?

PS .save() is done from code, not with a button connected to dataset.

Do you have multiple instances where you’re trying to save or insert or update database? I’ve run into issues where you cannot save when another save is occurring. Send code snippets if possible.

Thanks David, but that´s not it. It´s the simplest of forms, with 1 datefield on it. I think it´s more somewhere between a bug and a feature, for if you read the datepicker doc, it states the onChange is not raised when setting a date in code. This has then repercussions for the .save(), for nothing changed (although it did), so nothing to save.

I think I can work my way out of it in two ways:

  1. use setField before the .save()
  2. set some other (dummy) field to a new value, thus triggering a change.

I´ll try 1) first.

Yep, setField works like a charm. This was almost a monologue, a self help session in progress. Sorry about that.