Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

open next calendar

Questions related to using nuBuilder Forte.
Post Reply
Timo
Posts: 221
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

open next calendar

Unread post 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.
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: open next calendar

Unread post 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); 
You do not have the required permissions to view the files attached to this post.
Timo
Posts: 221
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: open next calendar

Unread post 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?
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: open next calendar

Unread post 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()
admin
Site Admin
Posts: 2829
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: open next calendar

Unread post by admin »

.
Post Reply