|
Rank: Advanced Member Groups: Member
Joined: 8/9/2007 Posts: 59
|
Hi Friends
I am trying method function ValidateDates() { //ear the message first var errorDiv = document.getElementById("error_div"); errorDiv.innerHTML = ""; //Get both datesvar startDate = eo_GetObject("OpenDatePicker").getSelectedDate(); var startDate = document.getElementById("ctl00_ContentPlaceHolder1_ArrivalDatePicker"); var endDate = document.getElementById("ctl00_ContentPlaceHolder1_DepartureDatePicker"); alert(startDate); //Check if both dates are provided if ((startDate == null) || (endDate == null)) { errorDiv.innerHTML = "Please enter both dates."; return false; } if (startDate.valueOf() > endDate.valueOf()) { alert("The start date must be before the end date."); errorDiv.innerHTML = "The start date must be before the end date."; return false; } }
This is the standard method suggested for checking the DatePicker at the client side. But i am not able to get the control i see. I try to get the Datepicker and i see it from alert. it show [Object]. That means i think i am not able to get the Datepicker.
Any suggestions or help would be appreicated.
Thanks
Cheers Menon
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
eo_GetObject("OpenDatePicker").getSelectedDate() is the correct way to get date value from our date picker. document.getElementById("ctl00_ContentPlaceHolder1_ArrivalDatePicker") is wrong. It will get you the DHTML object, not the date.
|
|
Rank: Advanced Member Groups: Member
Joined: 8/9/2007 Posts: 59
|
i tired var startDate = eo_GetObject("ArrivalDatePicker").getSelectedDate() ; var endDate = eo_GetObject("DepartureDatePicker").getSelectedDate() ; alert(startDate); I got alert of message Undefined
|
|
Rank: Advanced Member Groups: Member
Joined: 8/9/2007 Posts: 59
|
hi there I am sorry..its working fine..yes the object it shows undefined..But it is catching the error.
Thanks alot.. :)
Cheers Menon
|
|