Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jared Sharen on Oct 19, 2008 20:20
open dhtmlx forum
dhtmlxDblCalendar issue

I am running into an issue with the double calendar.

I have implemented the following code:

<fieldset class="fieldset">
<legend>Category:</legend>
<div style="padding:3px">
Please select the start and end dates for this contest.
     <input type="text" name="data1" value="06/01/2008" id="data1">
     <input type="text" name="data2" value="15/01/2008" id="data2">
</div>
<div id="dhtmlxDblCalendar"></div>
</fieldset>


<script>
    window.onload = function () {
    var mDCal;
        mDCal = new dhtmlxDblCalendarObject('dhtmlxDblCalendar', false, {isMonthEditable: true, isYearEditable: true});
        mDCal.setYearsRange(1980, 2020);
        mDCal.setDateFormat("%d/%m/%Y");

mDCal.leftCalendar.setSkin("simplecolorsand");
mDCal.leftCalendar.setOnClickHandler(function(date){
                document.getElementById('data1').value=this.getFormatedDate(null,date);
                mDCal.rightCalendar.setSensitive(date,null)
                return true;
        });

mDCal.rightCalendar.setSkin("simplecolorsand");
        mDCal.rightCalendar.setOnClickHandler(function(date){
                document.getElementById('data2').value=this.getFormatedDate(null,date);
                mDCal.leftCalendar.setSensitive(null,date)
                return true;
        });


        mDCal.setDate(document.getElementById('data1').value,document.getElementById('data2').value)
        mDCal.draw();
    }
    
    
    </script>

This is a sample straight out of one of your examples. For now I am just trying to get it all working smoothly then I will integrate it with my site. However the problem I have is that this code when done in a stand alone html file (with the js files initiated the same way in both) it works just fine.

Embedded in my page however I get the following behaviour:

Click on the right calendar date, and the left calendar date updates perfectly as I would expect. It also updates the input field attached.

When I click on the left calendar date however, the attached input field is updated, but the right calendar is completely disabled and will no longer interact.

I love the product and am just making sure it all works properly on my site before purchasing a full license.

Thanks!
Jared
Answer posted by Support on Oct 20, 2008 04:25
Parameters for method setSensitive (fromDate, toDate) must be dates.
Therefore you have to replace 2 lines
mDCal.rightCalendar.setSensitive(date,null)   with   mDCal.rightCalendar.setSensitive(new Date(date),null)
mDCal.leftCalendar.setSensitive(null,date)   with  mDCal.leftCalendar.setSensitive(null,new Date(date))