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

Issue Setting Focus RadDatePicker

1 Answer 125 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 16 Sep 2011, 02:42 PM
I am having an issue setting focus on the text box of a RadDatePicker.  I handle the 

OnDateSelected 

 

 

event and then set focus using:

e.get_textBox().focus();
e.get_textBox().select();

however this only works when there is no date in the textbox.  If I choose another date focus may be at that object but the cursor is not visible.  Currently I have a workaround to handle this but it is not elegant:

function

 

 

OnDatePopupClosing(e, args) {

 

 

 

 

 

try

{

 

SelectedDate = e.get_selectedDate();

 

 

 

 

if (SelectedDate) {

 

 

 

e.get_textBox().value =

 

''

;

 

}

}

 

catch (err) {

 

 

 

alert(

 

"Error encountered: " + err.message)

 

}

}

function

 

 

OnDateSelected(e, args) {

 

 

 

 

 

try

{

 

 

 

if (e.CalendarSelectionInProgress) {

 

 

 

e.get_textBox().select();

}

}

 

 

 

catch (err) {

 

 

 

alert(

 

"Error encountered: " + err.message)

 

}

}

 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Sep 2011, 05:28 AM
Hello Robert,

You could achieve the desired behavior from client side.For that you need to
  • Get the client-side instance of the combobox
  • Get the DOM element of the input field
  • Focus the input field

Please check this help article which which explains more on this.

Thanks,
Shinu.
Tags
Calendar
Asked by
Robert
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or