This is a migrated thread and some comments may be shown as answers.

DatePicker value is empty when valid value is set to the input on the server side

1 Answer 1866 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 09 Aug 2013, 12:58 PM
Test case:
1. I type "March 2015" into DatePicker
2. Kendo validator accepts this value, i.e. "kendo.parseDate(input.val()) !== null". So the form can be submitted.

The first problem: pop-up calendar does not show the date 03/01/2015. Why? 

3. On the server side I have model property  correctly binded from the incoming value "March 2015" (so it has value "03/01/2015"). And I return the same view with the same model. That value is again rendered as <input value="March 2015"...>

The second problem:
 I have empty value in datepicker in browser. 
Is there a way to get value in datepicker in this situation? I'm awared about parseFormats parameter. But why the default behavior is so strange? Why you do not use kendo.parseDate(input.value) when no parse formats are given explicitly?

The same problem is here when I type date in some other formats - '2013/02/13' for example. Kendo Validator accepts this value, MVC default model binder accepts this value, but widget does not. It seems to me you use ""format" property of DatePicker options to parse a value when parseFormats are not given explicitly.

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 13 Aug 2013, 10:31 AM
Hi Anton,

 
Basically your findings that the widget doesn't accept formats other than the specified one if they are not added to the "parseFormats" collection is correct (current behavior is expected and intended). In current case I would suggest to add all formats that the widget should accept to the parseFormats collection. 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Anton
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or