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

2 posts, 0 answers
  1. Anton
    Anton avatar
    8 posts
    Member since:
    Aug 2013

    Posted 09 Aug 2013 Link to this post

    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.
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 13 Aug 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top