Buy Now
Sign in

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

jj135 , November 08 at 16:41
jj135

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

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)?