Only a hideous timeout hack will work: http://jsbin.com/agitu/edit


$("#dpTo").datepicker({
  dateFormat: 'dd/mm/yy',
  onSelect: function(dateText, inst) {
    $('#dpFrom').datepicker('option','maxDate', new Date
(inst.selectedYear, inst.selectedMonth, inst.selectedDay));
  }

});
$("#dpFrom").datepicker({
  dateFormat: 'dd/mm/yy',
  onSelect: function(dateText, inst){
    //hack: must use timeout to allow first dp to close
    setTimeout(function(){
      $("#dpTo").datepicker('option','minDate', new Date
(inst.selectedYear, inst.selectedMonth, inst.selectedDay)).focus();
    },100); //you may need to tweak the timeout value
  }
});


On Aug 29, 2:43 pm, Bela Bujk <[email protected]> wrote:
> I've tried different ways but in case the second calendar is opened upon the
> first one's onSelect event, it simply won't close by any user interaction.
> Provided this is a bug what chance do I have that this gonna be fixed in the
> close future? Unfortunately my client insists on the
> one-closes-the-other-pops-up solution so I would really appreciate someone
> giving me a hint how to accomplish that with Jquery UI Datepicker. There
> must be a tricky solution.
>
> thx
>
> 2009/8/27 Fontzter <[email protected]>
>
>
>
> > I was able to reproduce this and think that it is a bug.  Others may
> > want to weigh in though.  A complete guess: but it may have something
> > to do with the first dp not being closed before the second is
> > displayed.
>
> > Have you seen this?
> >http://www.filamentgroup.com/examples/daterangepicker_v2/index3.php
>
> > You may be able to look at their code for the date range picker and
> > see how it is done.  I like the idea of seeing the start calendar and
> > end calendar at the same time.  Automatically popping another calendar
> > up for another field may confuse some end users; whereas two calendars
> > clearly label may be more intuitive.
>
> > Dave
>
> > On Aug 26, 3:25 pm, tersyxus <[email protected]> wrote:
> > > I have two date fields. After the first date is selected the second
> > > field gets focused making the second datepicker pop up but it won't
> > > close after the second date is selected. This problem is present in
> > > Firefox 3.5 and Opera 9 but not in IE6/7.
> > > Source:http://repulj.hu/newsite/a.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to