Set date when using Kendo date picker

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Justin Peszleny
Posts: 5
Joined: Tue Mar 25, 2014

13 Jan 2017

I am trying to set the date programtically using a Kendo datetime picker but the date won't save. Is there a special trick to get this to work?

I am using moment.js and simply setting the date like this:

fd.field("CA1Date").value(moment().format());

The date shows up inside the Kendo datetime picker but when I save the form it doesn't save.

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

17 Jan 2017

Hi,

Try to pass a date object into the value method, ex.:

fd.field('FieldName').value(new Date());

Justin Peszleny
Posts: 5
Joined: Tue Mar 25, 2014

17 Jan 2017

Thanks for the reply. Just tried that but still doesn't work. The value gets set in the textbox but isn't saved when saving the form. Is there any special functions that are called when using the Kendo Date Picker to make this work?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

17 Jan 2017

Hi,

You're right, the issue is in our code. We will fix it soon. For now, use the following code to set kendo Date field:

Code: Select all

fd.field('FieldName').control('kendoDatePicker').done(function(datePicker) {
	datePicker.value(new Date());
	datePicker.trigger('change');
});

Justin Peszleny
Posts: 5
Joined: Tue Mar 25, 2014

17 Jan 2017

Perfect! Tried that and it works. Thanks!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests