Welcome Guest Search | Active Topics | Sign In | Register

Calendar object goTo method not working Options
Greg
Posted: Monday, July 27, 2009 6:23:52 PM
Rank: Newbie
Groups: Member

Joined: 7/10/2009
Posts: 4
I am trying to use the calendar objects javascript goTo method to reset the default date when the calendar popup is activiated. However everytime I call this I get an object does not support this property or method error. Am I doing something wrong.


Code: JavaScript
function PopupCalendarSelect(calendar)
{
    document.getElementById(document.getElementById("<%=HiddenFieldCalendar.ClientID %>").value).value = calendar.formatDate(calendar.getSelectedDate(),'MM/dd/yyyy');
    calendar.goTo(Date()); //this is causing an error. Want to reset default view after user picks a date
}

function ShowPopupCalendar(sender)
{
    document.getElementById("<%=HiddenFieldCalendar.ClientID %>").value = 'txt' + sender.id;
    eo_GetObject('PopupCalendar').setSelectedDate(Date());
    eo_ShowPopupCalendar('PopupCalendar',sender);
    
}


Code: HTML/ASPX
<asp:TextBox ID="txtDateTest" runat="server" readonly="true"/>
        <asp:Image ID="DateTest" runat="server" ImageUrl="~/Calendar.gif" AlternateText="hello_greg" onclick="ShowPopupCalendar(this);" />
        
        <eo:popupcalendar id="PopupCalendar" runat="server"  controlskinid="None" daycellheight="15"
            daycellwidth="31" dayheaderformat="Short" disableddates="" othermonthdayvisible="True"
            selecteddates="" titleformat="MMMM, yyyy" titleleftarrowimageurl="DefaultSubMenuIconRTL"
            titlerightarrowimageurl="DefaultSubMenuIcon" visibledate="2009-07-01" ClientSideOnSelect="PopupCalendarSelect">
<TitleStyle CssText="font-family:Verdana;font-size:8.75pt;padding-bottom:5px;padding-left:5px;padding-right:5px;padding-top:5px;"></TitleStyle>

<CalendarStyle CssText="background-color:white;border-bottom-color:Silver;border-bottom-style:solid;border-bottom-width:1px;border-left-color:Silver;border-left-style:solid;border-left-width:1px;border-right-color:Silver;border-right-style:solid;border-right-width:1px;border-top-color:Silver;border-top-style:solid;border-top-width:1px;color:#2C0B1E;padding-bottom:5px;padding-left:5px;padding-right:5px;padding-top:5px;"></CalendarStyle>

<DayHoverStyle CssText="font-family:Verdana;font-size:8pt;background-image:url('00040402');color:#1c7cdc;"></DayHoverStyle>

<MonthStyle CssText="cursor:hand;margin-bottom:0px;margin-left:4px;margin-right:4px;margin-top:0px;"></MonthStyle>

<DayHeaderStyle CssText="font-family:Verdana;font-size:8pt;border-bottom: #f5f5f5 1px solid"></DayHeaderStyle>

<DayStyle CssText="font-family:Verdana;font-size:8pt;"></DayStyle>

<SelectedDayStyle CssText="font-family:Verdana;font-size:8pt;background-image:url('00040403');color:Brown;"></SelectedDayStyle>

<DisabledDayStyle CssText="font-family:Verdana;font-size:8pt;color: gray"></DisabledDayStyle>

<TodayStyle CssText="font-family:Verdana;font-size:8pt;background-image:url('00040401');color:#1176db;"></TodayStyle>

<FooterTemplate>
<table style="font-size: 11px; font-family: Verdana" border="0" cellspacing="5" cellPadding="0">
	<tr>
		<td width="30"></td>
		<td valign="center"><img src="{img:00040401}"></td>
		<td valign="center">Today: {var:today:MM/dd/yyyy}</td>
	</tr>
</table></FooterTemplate>

<TitleArrowStyle CssText="cursor: hand"></TitleArrowStyle>
</eo:popupcalendar>
eo_support
Posted: Monday, July 27, 2009 6:48:13 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Please change:

Code: JavaScript
calendar.goTo(Date());


To:

Code: JavaScript
calendar.goTo(new Date());


Note the "new" keyword in the second form. The first line calls Date function and passes the return value of the function (a string object) to goTo method. The second line creates a Date object and passes the date object to goTo method. Because goTo method expects a Date object, the second line is correct.

Thanks!


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.