...

View Full Version : DateTimePicker not working + rainforest javascript



thisismine
04-28-2008, 06:23 PM
Hi,

I am using datetimepicker from rainforest.From the code below The pCtrl value is open date but the exDateTime value is read undefined becoz of this the window is not opening....Can you please tell me what is wrong in this code?


Here is the code:
<script language="javascript" type="text/javascript" src="/js/datetimepicker.js">
</script>
..
,...
...
<td width="25%" class="tableContainer" id="opendate">Open Date(mm/dd/yyyy) * </td>
<td width="25%" ><input type="text" size="25" name="opendate" id="opendate" class="inputBox4"><a href="javascript:NewCal('opendate','mmddyyyy')"><img onmouseover="this.style.cursor='hand'" src="/ts/images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>

And the javascript code:
function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
{
Cal=new Calendar(dtToday);
if ((pShowTime!=null) && (pShowTime))
{
Cal.ShowTime=true;
if ((pTimeMode!=null) &&((pTimeMode=='12')||(pTimeMode=='24')))
{
TimeMode=pTimeMode;
}
}
if (pCtrl!=null)
Cal.Ctrl=pCtrl;
if (pFormat!=null)
Cal.Format=pFormat.toUpperCase();
alert("pCtrl-->"+pCtrl);
//exDateTime=document.getElementById(pCtrl).value;

exDateTime = "00/00/0000";
alert("exDateTime-->"+exDateTime);
if (exDateTime !="")//Parse Date String
{
var Sp1;//Index of Date Separator 1
var Sp2;//Index of Date Separator 2
var tSp1;//Index of Time Separator 1
var tSp1;//Index of Time Separator 2
var strMonth;
var strDate;
var strYear;
var intMonth;
var YearPattern;
var strHour;
var strMinute;
var strSecond;
//parse month
Sp1=exDateTime.indexOf(DateSeparator,0)
Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1)+1));

if ((Cal.Format.toUpperCase()=="DDMMYYYY") || (Cal.Format.toUpperCase()=="DDMMMYYYY"))
{
strMonth=exDateTime.substring(Sp1+1,Sp2);
strDate=exDateTime.substring(0,Sp1);
}
else if ((Cal.Format.toUpperCase()=="MMDDYYYY") || (Cal.Format.toUpperCase()=="MMMDDYYYY"))
{
strMonth=exDateTime.substring(0,Sp1);
strDate=exDateTime.substring(Sp1+1,Sp2);
}
if (isNaN(strMonth))
intMonth=Cal.GetMonthIndex(strMonth);
else
intMonth=parseInt(strMonth,10)-1;
if ((parseInt(intMonth,10)>=0) && (parseInt(intMonth,10)<12))
Cal.Month=intMonth;
//end parse month
//parse Date
if ((parseInt(strDate,10)<=Cal.GetMonDays()) && (parseInt(strDate,10)>=1))
Cal.Date=strDate;
//end parse Date
//parse year
strYear=exDateTime.substring(Sp2+1,Sp2+5);
YearPattern=/^\d{4}$/;
if (YearPattern.test(strYear))
Cal.Year=parseInt(strYear,10);
//end parse year
//parse time
if (Cal.ShowTime==true)
{
tSp1=exDateTime.indexOf(":",0)
tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));
strHour=exDateTime.substring(tSp1,(tSp1)-2);
Cal.SetHour(strHour);
strMinute=exDateTime.substring(tSp1+1,tSp2);
Cal.SetMinute(strMinute);
strSecond=exDateTime.substring(tSp2+1,tSp2+3);
Cal.SetSecond(strSecond);
}
}
winCal=window.open("","DateTimePicker","toolbar=0,status=0,menubar=0,fullscreen=no,width=195,height= 200,resizable=0,top="+cnTop+",left="+cnLeft);
docCal=winCal.document;
RenderCal();
}

Thanks in Advance

adhikra
01-25-2011, 09:12 PM
Were you able to resolve your issue. I am trying to find out how to pick a date in the past. Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum