Page 1 of 1

open next calendar

Posted: Sat Sep 08, 2018 11:02 am
by Timo
Let's say I have 2 date input objects:

Date From: ______
Date To: ______

I would like to achieve the following: As soon as a date has been picked from the popup calendar of the Date From field, the calendar of the Date To will show up.

Example: I pick 2019-12-01 and the calendar of the "Date to" field would appear with the initial date of the "Date From" picker.

Re: open next calendar

Posted: Sat Sep 08, 2018 6:03 pm
by toms
Hi:

Add some custom JS in the "Date From" field (onchange event):

This should open the popup calendar of the "Date To" Field (Untested!)

Code: Select all

var df = $('#dateFrom').val(); nuPopupCalendar($('#dateTo')[0], df); 

Re: open next calendar

Posted: Mon Sep 10, 2018 12:55 pm
by Timo
Toms, this does not work for me. Nothing happens after picking a date from the 1st calendar. Do you have a clue as to why that is so?

Re: open next calendar

Posted: Sat Sep 22, 2018 3:56 am
by toms
Timo wrote:Toms, this does not work for me. Nothing happens after picking a date from the 1st calendar. Do you have a clue as to why that is so?
Here's the trick. use setTimout() to make it work

Code: Select all

var df = $('#dateFrom').val(); if(df !== '') {  setTimeout(function() {    $('#dateTo').focus();    nuPopupCalendar($('#dateTo')[0], df);  }, 100);}
...and it's maybe better to move the (long) code into a separate function like function openNextCalendar()

Re: open next calendar

Posted: Mon Oct 01, 2018 5:25 am
by admin
.