How can we include condition on the return date cannot be before the departure dat

  • fredpiq
    Asked on September 1, 2016 at 10:07 AM
    4. how can we include condition on the calendar => the return date cannot be before the departure dat
  • Boris
    Replied on September 1, 2016 at 10:32 AM

    Yes, we can achieve your requirement by using a Form Calculation field to calculate the difference between the two date fields, and a Text field to display an error message to your users if the difference is less than 1 day..

    Step 1. We need to add a Form Calculation, and set it to calculate the "Date of Return minus Date of Departure":

    https://www.jotform.com/help/259-How-to-perform-calculation-in-the-form

    How can we include condition on the return date cannot be before the departure dat Image 1 Screenshot 50

    We can set this field as hidden, so that it does not confuse your users:

    How can we include condition on the return date cannot be before the departure dat Image 2 Screenshot 61

    Step 2. We should add a Text field, which will contain the error message you want to show to your users when they pick the arrival date that is prior to departure:

    How can we include condition on the return date cannot be before the departure dat Image 3 Screenshot 72

    Step 3. Finally, we use a single show condition to display our custom error message if the calculation is less than 0, meaning the arrival date is not after the departure date:

    https://www.jotform.com/help/57-Smart-Forms-Using-Conditional-Logic

    This rule should also have a hide action added, where it hides the Submit button during the error:

    How can we include condition on the return date cannot be before the departure dat Image 4 Screenshot 83

    You can see a demo form with these steps applied here:

    https://form.jotformpro.com/form/62444057214955

    Please try the above steps, and if you need further assistance, please let us know.