How can I reset a datetime field (set it to NULL)?

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
DonCortizone
Posts: 2
Joined: Wed May 15, 2019

15 May 2019

Hi,

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
    }
}
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!

DonCortizone
Posts: 2
Joined: Wed May 15, 2019

16 May 2019

I finally found it, you have to assign an empty string:

Code: Select all

fd.field('someDateTimeField').value('');

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests