Forums

Two datepickers -> use first date as startdate for second date

jj135 08 Nov, 2017
Hi! When I use two datepickers in a form, one for a startdate of an event and one for an end date of an event, how do I get the second datepicker popup to start on the selected date of the first datepicker field?

So:

FIELD1 (datepicker) : User enters this value: 01-01-2019
FIELD2 (datepicker): user clicks on field and popup shows the '01-01-2019' as starting date.

This ensures the user does not have to browse twice to find a date in the future.

I tried setting the value of 'endcalendar' in the first date field to the ID of the second field. And setting the 'startcalendar' tot the ID of the first field in the second date field. But that did not seem to do the trick...

Is it also possible to validate the second (end) date as being AFTER the first date?

Kind regards,
Jip
jj135 08 Nov, 2017
I got it working. Not sure what I did, but maybe there was a caching issue while testing the site. I did exactly what I described above: Setting the field ID of the second date field as 'endcalendar. And in the seconf (end) date field I set 'startcalendar' to the ID of the first date field.

This question remains:

Is it possible to validate (javascript) the second (end) date as being AFTER the first date filed (value)?
hwsassisi 25 Feb, 2018
I have to make the same form, with check-in and check-out dates.
Obviously check-in date starts from tomorrow and check-out date must be at least one day after check-in date.

In checkInCalendar, set #checkOutCalendar in "End Calendar" advanced field
In checkOutCalendar, set #checkInCalendar in "Start Calendar" advanced field

But, in this case, checkOutCalendar accepts the same date the checkInCalendar.
How is possible to force checkOutCalendar to start 1 day after checkInCalendar?

Regards
Max_admin 03 Mar, 2018
Hi,

Maybe you will need some custom js validation function for this, after the date is selected you can parse it and check if its the same date or not.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.