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

Retain focus on invalid input

3 Answers 183 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Lynx IT
Top achievements
Rank 1
Lynx IT asked on 22 May 2015, 02:17 AM

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

 

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 25 May 2015, 03:58 PM

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!
 
0
Lynx IT
Top achievements
Rank 1
answered on 28 May 2015, 01:42 AM

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?

0
Boyan Dimitrov
Telerik team
answered on 01 Jun 2015, 07:37 AM

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!
 
Tags
Date/Time Pickers
Asked by
Lynx IT
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Lynx IT
Top achievements
Rank 1
Share this question
or