Check in and check out on date picker

I’m trying to figure out how to do something with the date picker and it is not coming to me. I have a reservation form — there is a check in date and a check out date. Most people are checking in for long term stays, and booking way in advance. So, here is the scenerio… someone comes to the website on January 1st, and books a check in date of July 1st. The next field is a date picker for check out date. We want that to automatically go to dates AFTER July 1st (or the date they picked as their CHECK IN date), so they don’t have to scroll through Jan, Feb, Mar, Apr, May, Jun to get to a possible check out date. I hope that makes sense. Is this doable?

You can use the gform_datepicker_options_pre_init JavaScript filter to handle this.

Example #3 in the linked filter doc will set the minimum selectable date for the second datepicker to the date selected in the first datepicker. Similarly example #4 would set the minimum date of the second datepicker to the first datepicker value plus one month.

For a less code intensive solution Gravity Wiz’s Limit Dates perk can do similar things for you: Gravity Forms Limit Dates - Gravity Wiz


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.