-
countryk9Asked on July 23, 2020 at 9:20 PM
https://form.jotform.com/202047570353146
Page 9 - Arrival Date field and Departure Date field
Is it possible to prevent the date selected in the Departure Date field from being before the Arrival Date? For example, I would like to prevent the Departure Date be earlier than the Arrival Date:
-
John Support Team LeadReplied on July 23, 2020 at 11:57 PM
Since there is no direct option to automatically disable some dates into a date picket field based on another field's data, I came up with a solution to just warn or inform the user that he's selecting an invalid date.
Here's what I came up with:
1. Add a FORM CALCULATION widget to the form. We will calculate the difference between the two date fields (Departure - Arrival):
GUIDE: How-to-Perform-Form-Calculation-Using-a-Widget
2. Then add a PARAGRAPH field that will contain a message to the user (shown in the screenshot below in AMBER).
3. Add a condition to show the said message based on the difference of the said date fields. If it's less than 1, it means that the Arrival Date is the same or is later than the Departure Date, which is not allowed.
This condition shows the MESSAGE and hides the NEXT button so the user can't proceed to the next page while the Departure date is INVALID.
You can just hide the FORM CALCULATION widget to your form so the user won't be able to see it.
I have implemented this into a cloned form. Here's a link to it: https://form.jotform.com/202048876286969?jumpToPage=8
-
countryk9Replied on July 24, 2020 at 9:35 AM
I added an IF for Departure Date Is Filled so it didn't show the message until you picked a date that was earlier. Thank you!