Welcome Guest Search | Active Topics | Sign In | Register

getSelectedDate() causing datepicker problem Options
SDDP
Posted: Friday, May 1, 2009 6:27:07 PM
Rank: Member
Groups: Member

Joined: 3/16/2009
Posts: 23
I have two date pickers and I want to set the second one's date when the user chooses a date in the first one. I have found that if I use the getSelectedDate() method on the first date picker, then the user cannot select a date from the calendar. It just doesn't change. They can still change the date with the keyboard.

The first datepicker looks like:

Code: HTML/ASPX
<eo:DatePicker ID="Common_Proposed_Eff_DateDatePicker" runat="server" ControlSkinID="None" CssBlock=""  Width="90px"
                DayCellHeight="15" DayCellWidth="31" DayHeaderFormat="Short" DisabledDates="" ClientSideOnChange="Common_Proposed_Eff_Date"
                OtherMonthDayVisible="True" SelectedDates="" TitleFormat="MMMM, yyyy" 
                TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" 
                TitleRightArrowImageUrl="DefaultSubMenuIcon" selecteddatestring='<%# Bind("Common_Proposed_Eff_Date") %>' MinValidDate="1900-01-01" MaxValidDate="2079-06-06" >
                <TodayStyle CssClass="DatePicker5" />
                <SelectedDayStyle CssClass="DatePicker8" />
                <DisabledDayStyle CssClass="DatePicker6" />
                <FooterTemplate>
                    <table border="0" cellPadding="0" cellspacing="5" 
                        style="font-size: 11px; font-family: Verdana">
                        <tr>
                            <td width="30">
                            </td>
                            <td valign="center">
                                <img src="{img:00040401}"></img></td>
                            <td valign="center">
                                Today: {var:today:MM/dd/yyyy}</td>
                        </tr>
                    </table>
                </FooterTemplate>
                <CalendarStyle CssClass="DatePicker1" />
                <TitleArrowStyle CssClass="DatePicker9" />
                <DayHoverStyle CssClass="DatePicker4" />
                <MonthStyle CssClass="DatePicker7" />
                <TitleStyle CssClass="DatePicker10" />
                <DayHeaderStyle CssClass="DatePicker2" />
                <DayStyle CssClass="DatePicker3" />
                <PickerStyle CssClass="DatePicker11" />
            </eo:DatePicker>


The script:

Code: JavaScript
function Common_Proposed_Eff_Date()
        {
            var ex = eo_GetObject('Common_Proposed_Exp_DateDatePicker');
            var deff = eo_GetObject('Common_Proposed_Eff_DateDatePicker');
            var dt = deff.getSelectedDate();
            //var dt = ctl00_ContentPlaceHolder1_ctl00_AppFormView_Common_Proposed_Eff_DateDatePicker.getSelectedDate();
            //ex.setSelectedDate(dt);
        }


If I comment out the first 'var dt = ...' line then the datepicker works correctly again.

Thanks
eo_support
Posted: Friday, May 1, 2009 9:02:50 PM
Rank: Administration
Groups: Administration

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

Try to use setTimeout to delay the call:

Code: JavaScript
function Common_Proposed_Eff_Date()
{
    setTimeout(
        function()
        {
            var ex = eo_GetObject('Common_Proposed_Exp_DateDatePicker');
            var deff = eo_GetObject('Common_Proposed_Eff_DateDatePicker');
            var dt = deff.getSelectedDate();
            .....
        }, 100);
}


This allows the function to be executed after all internal states for the DatePicker are set.

Thanks!
SDDP
Posted: Monday, May 4, 2009 7:51:32 PM
Rank: Member
Groups: Member

Joined: 3/16/2009
Posts: 23
That seemed to work.

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.