Set the date limit based on another date field's value

  • magicbound
    Asked on January 23, 2022 at 5:12 PM
    Another question. I use two date pickers (arrival date & departure date). Is there a way for the second date to only show dates in the future from the selected arrival date? I've tried to set the limits to ={arrivalDate} and {arrivalDate}+15, but that hasn't worked.
  • John Support Team Lead
    Replied on January 23, 2022 at 5:50 PM

    Unfortunately, it is not possible to dynamically set the start/end date in departure field. You can just add a condition to check if the date falls within the allowed date or not.

    So to better illustrate, here's an example of how you can set it up:

    1.) Add a form calculation widget to the form that determines the difference between the Arrival and Departure dates:

    1642978013 61eddadd1fb82  Screenshot 10

    2.) Next, add a paragraph field that conveys a message if the selected Departure date is less than 15 days from the Arrival Date:

    1642977970 61eddab21ac64  Screenshot 21

    3.) Then use a condition to show the said paragraph field if the form calculation's value is less than 15. At the same time, hide the submit button so the user cannot submit it:

    1642978206 61eddb9e5f2be  Screenshot 32

    And that's it! Here's a demo form: https://form.jotform.com/220226905795056