How can I reset a datetime field (set it to NULL)?
Posted: 15 May 2019
Hi,
I'm trying to set a DateTime field to null, when a user clicks on a checkbox:
Setting a datetime field to null, leaves the values in the UI unchanged. And when saved, the original date value is saved and not the null value.
As a work-around I tried hiding the datetime control. This works, but there is still a datetime value saved instead of a null value.
How can I reset a datetime field (set it to NULL)? Any help is highly appreciated!
I'm trying to set a DateTime field to null, when a user clicks on a checkbox:
Code: Select all
function onSomeBooleanFieldChange() {
if (fd.field('someBooleanField').value() != true) {
fd.field('someDateTimeField').value(new Date()); // works
}
else {
fd.field('someDateTimeField').value(null); // does not work
}
}
As a work-around I tried hiding the datetime control. This works, but there is still a datetime value saved instead of a null value.
How can I reset a datetime field (set it to NULL)? Any help is highly appreciated!