Set date when using Kendo date picker

rss

Posted by Justin Peszleny - Jan 13 ’17 at 11:41

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.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #1 by Dmitry Kozlov Jan 17 ’17 at 09:01

    Hi,

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

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

  • Justin Peszleny
    Justin Peszleny
    Member
    Member for: 5 years 4 months 26 days
    #2 by Justin Peszleny Jan 17 ’17 at 10:04

    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?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 5 years 10 months 28 days
    #3 by Dmitry Kozlov Jan 17 ’17 at 11:22

    [#2]: 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:

    fd.field('FieldName').control('kendoDatePicker').done(function(datePicker) {
    	datePicker.value(new Date());
    	datePicker.trigger('change');
    });
    
  • Justin Peszleny
    Justin Peszleny
    Member
    Member for: 5 years 4 months 26 days
    #4 by Justin Peszleny Jan 17 ’17 at 11:56

    Perfect! Tried that and it works. Thanks!

Displaying 1 to 4 of 4 messages