Welcome Guest Search | Active Topics | Sign In | Register

Using DatePicker at Client-Side Options
Menon
Posted: Tuesday, November 27, 2007 7:50:59 AM
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
eo_support
Posted: Tuesday, November 27, 2007 7:55:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
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.
Menon
Posted: Tuesday, November 27, 2007 8:03:05 AM
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
Menon
Posted: Tuesday, November 27, 2007 8:12:50 AM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.