RadDatePicker's method _setInputDate don't works in Mozilla correctly.

2 posts, 0 answers
  1. Andrew Newton
    Andrew Newton avatar
    6 posts
    Member since:
    Apr 2006

    Posted 24 Aug 2009 Link to this post

    Hi. I'm working with Sitefinity and using there two RadDatePickers. I need to have next action 

    1. Select date in the first raddatepicker.

    2. Set selected date in the 2-d raddatepicker = 1-t raddatepicker date + 1 day using client side javascript

    In IE and Opera it works pretty good ,but in Mozilla have problems. Whenexecuting event _setInputDate raizes validation and no data selected. I have tried to set DateInput-CausesValidation="false" ,but nothing happends with and without this attribute.

    Here the code

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div> 
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

    <script type="text/javascript">  
    function dateSelected(sender, args) {
    var datePicker = $find("<%= InprDeparture.ClientID %>");
    var date = args._newDate;
    datePicker._setInputDate(new Date(date.getYear(), date.getMonth(), date.getDate() + 1));
    }  
    </script>


    </telerik:RadCodeBlock>  

    <h5>Arrival</h5>
    <telerik:RadDatePicker ID="InprArrival" Style="vertical-align: middle;" Width="160px" MinDate="2006-02-01" runat="server" MaxDate="2099-12-16">
    <ClientEvents OnDateSelected="dateSelected" />
    </telerik:RadDatePicker>

    <h5>Departure</h5>
    <telerik:RadDatePicker DateInput-CausesValidation="false" ID="InprDeparture" Style="vertical-align: middle;" Width="160px" MinDate="2006-02-01" runat="server" MaxDate="2099-12-16" >  
    </telerik:RadDatePicker>
    <telerik:RadCalendar></telerik:RadCalendar>  
    </div>
    </form>
    </body>
    </html>

  2. Dimo
    Admin
    Dimo avatar
    8456 posts

    Posted 27 Aug 2009 Link to this post

    Hi Andrew,

    The problem is caused by a browser inconsistency and incorrect usage of the Javascript Date Object API. Please refer to:

    http://www.w3schools.com/jsref/jsref_getYear.asp

    http://www.w3schools.com/jsref/jsref_getFullYear.asp


    By the way, _SetInputDate is not a public method of the RadDatePicker. Please use this instead:

    datePicker.get_dateInput().set_selectedDate( .... );


    Best wishes,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top