Loading ...
Sorry, an error occurred while loading the content.

Interdependant calendars not working with Safari

Expand Messages
  • jannekalliola
    Hello, I m writing a web application that requires the user to set start and end dates for certain acitivities. I ve successfully used Yahoo Calendar class to
    Message 1 of 1 , Feb 27, 2006
    • 0 Attachment
      Hello,

      I'm writing a web application that requires the user to set start and end dates for certain
      acitivities. I've successfully used Yahoo Calendar class to create the calendars, and got the
      system working in most browsers except Safari.

      The set-up is as follows:
      - two calendars, cal1 and cal2.
      - onSelect function is a specific copyData() function that copies the calendar entry into an
      hidden field in YYYYDDMM format.
      - onSelect function is added to the calendar prototype:

      YAHOO.widget.Calendar.prototype.onSelect = copyDate;

      - the two calendars are linked together with the following method:

      function linkCals(cal1, cal2) {
      if(cal1 && cal2) {
      cal1.onPrevSelect = cal1.onSelect;
      cal1.onSelect = function() {
      var date1 = this.getSelectedDates()[0];
      var date2 = cal2.getSelectedDates()[0];
      if(!date2 || date2 < date1) {
      cal2.deselectAll();
      cal2.setMonth(date1.getMonth());
      cal2.setYear(date1.getFullYear());
      document.getElementById('trip_end').value = '';
      }
      cal2.minDate = date1;
      cal2.render();
      this.onPrevSelect();
      }
      }
      }

      - the function creates a reference point the current onSelect function, called onPrevSelect.
      Then it replaces the onSelect of cal1 (the start date) to remove selection from cal2, if the
      selected date is too early, and to set the minimum selectable date. The last step is to
      render the cal2 again and copy the cal1 date to the hidden field.

      In Safari, I can select dates from cal2 until I select a date in cal1. Then cal2 is frozen and
      stays so. Further, if I change the month of cal1 or cal2, they froze.

      Safari's JS debug window tells the following informative message:
      Undefined value
      Undefined Line: 0

      This has been working on various Mozilla based browsers on PC and Mac, so the code is,
      at least in principle, working ok.

      Anyone else seeing similar problems? Any ideas?
      --
      Janne Kalliola
    Your message has been successfully submitted and would be delivered to recipients shortly.