Page 1 of 1
Set date when using Kendo date picker
Posted: 13 Jan 2017
by Justin Peszleny
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.
Re: Set date when using Kendo date picker
Posted: 17 Jan 2017
by Dmitry Kozlov
Hi,
Try to pass a date object into the value method, ex.:
fd.field('FieldName').value(new Date());
Re: Set date when using Kendo date picker
Posted: 17 Jan 2017
by Justin Peszleny
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?
Re: Set date when using Kendo date picker
Posted: 17 Jan 2017
by Dmitry Kozlov
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');
});
Re: Set date when using Kendo date picker
Posted: 17 Jan 2017
by Justin Peszleny
Perfect! Tried that and it works. Thanks!