How can I reset a datetime field (set it to NULL)?
-
- Posts: 2
- Joined: Wed May 15, 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!
-
- Posts: 2
- Joined: Wed May 15, 2019
I finally found it, you have to assign an empty string:
Code: Select all
fd.field('someDateTimeField').value('');
-
- Information
-
Who is online
Users browsing this forum: No registered users and 14 guests