I just realized that if no date is selected it will crash, so you'll
want to change the onClose function to this:
onClose: function()
{
if(
$("#fromDate").datepicker('getDate') != null )
{
var day =
$("#fromDate").datepicker('getDate');
day.setDate(day.getDate()+1);
$("#toDate").datepicker('option', 'minDate', day );
}
}
On Dec 7, 8:40 pm, Mestek Webmaster <[email protected]> wrote:
> I'm doing the same thing using UI 1.7.2 with JQuery 1.3.2
>
> This code works for me:
>
> <script type="text/javascript" defer="defer">
> $(document).ready
> (
> function()
> {
> $('#fromDate').datepicker(
> {
> showAnim:'slideDown',
> onClose: function()
> {
> var day =
> $('#fromDate').datepicker('getDate');
>
> day.setDate(day.getDate()+1);
>
> $('#toDate').datepicker('option', 'minDate', day );
> }
> }
> );
> $('#toDate').datepicker(
> {showAnim:'slideDown'} );
> }
> );
> </script>
>
> On Dec 2, 7:19 am, biggunn <[email protected]> wrote:
>
> > I know this has been brought up before, but I have been unable to get
> > the solution previously offered to work. Here is what I need to do.
> > I have two datepickers on my page, in a "arrive" and "depart" type of
> > scenario. What I need to happen is to set the minDate of the "depart"
> > datepicker to be no sooner than date chosen by the "arrive"
> > datepicker.
> > For example, someone chooses to arrive on January 1, 2010. The depart
> > datepicker should not allow a date earlier than January 1, 2010 to be
> > chosen.
>
> > The code previously offered is below. I have played with this for a
> > couple of hours now and am getting nowhere. For some reason, it
> > breaks the "depart" datepicker and won't bring up the calendar at
> > all. Any help is greatly appreciated.
>
> > <script type="text/javascript">
> > $(document).ready(function() {
> > $("#arrive").datepicker({
> > minDate: new Date(2009, 11 - 1, 6),
> > onSelect: function(dateText, inst){
> > var day =
> > $("#arrive").datepicker("getDate");
> > day.setDate(day.getDate()+1);
> > $("#depart").datepicker
> > ("option","minDate",
> > day);
> > }
> > });
> > $('#calendar-trigger-arrive').click(function() {
> > $('#arrive').datepicker('show');
> > });
> > });
> > </script>
--
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.