Retain focus on invalid input

4 posts, 0 answers
  1. Lynx IT
    Lynx IT avatar
    12 posts
    Member since:
    Feb 2011

    Posted 21 May 2015 Link to this post

    Hi there,

    Is there a way for the date picker to retain focus on invalid input. I have managed to achieve this in the combobox control by calling the focus() method inside the change event if the data entered is rubbish. However the date picker does not have a focus event (or at least not one that works the same as the combo box one).

    I wonder if there is another way to achieve this?

    Thanks

     

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 25 May 2015 Link to this post

    Hello Lynx IT,

    The Kendo DatePicker widget element field returns the input element which holds the selected date string. I would suggest using the jQuery focus() method in order to focus the input element of the widget. 

    var datepicker = $("#datepicker").data("kendoDatePicker");
    datepicker.element.focus();

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Lynx IT
    Lynx IT avatar
    12 posts
    Member since:
    Feb 2011

    Posted 27 May 2015 in reply to Boyan Dimitrov Link to this post

    Thanks Boyan

     That works fine for controls directly on the page but doesn't seem to work for datepickers use as inline grid editors. The focus is still lost when the user attempts to tab out of the grid even though the jQuery focus is called in the change event.

     Any thoughts on how to get around that?

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 01 Jun 2015 Link to this post

    Hello Lynx IT,

    Please find a http://dojo.telerik.com/uWiQO example that shows how retain focus if user tabs out the cell that contains the data picker widget as editor. 

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready