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

calender: selection in JS doesn't work

1 Answer 45 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
lemon
Top achievements
Rank 1
lemon asked on 11 Mar 2009, 12:43 PM
Hallo,

I have to selected a date in JS. But the selected date isn't displayed and after postback the date is not available.

If I selected the date by selected date on datepicker via UI, it works fine.

Here my test code:

var

 

todaysDate = new Date();

 

 

var todaysDate2 = [todaysDate.getFullYear(), todaysDate.getMonth(), todaysDate.getDate()];

 

$find(controlId).get_calendar().selectDate(todaysDate2,

true);

 

$find(controlId).get_dateInput().set_value(todaysDate2);



Thanks for help

1 Answer, 1 is accepted

Sort by
0
lemon
Top achievements
Rank 1
answered on 11 Mar 2009, 02:54 PM
Now It works fine with these code:

var

 

arrSelectedDate = [selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate()];

 

selectedDate = inputBox.get_dateFormatInfo().FormatDate(selectedDate, inputBox.get_displayDateFormat());

$find(controlId).get_calendar().selectDate(arrSelectedDate,

true);

 

$find(controlId).get_dateInput().set_value(selectedDate);

$find(controlId).get_calendar().set_focusedDate(selectedDate);

$find(controlId).updated();

Tags
Calendar
Asked by
lemon
Top achievements
Rank 1
Answers by
lemon
Top achievements
Rank 1
Share this question
or