How to validate two dates using conditions?

  • traveldiunsa
    Asked on February 29, 2016 at 1:30 PM

    Hi, I have a form where the user select Dates for Flight Quotes.

    I have 2 calendar pickers, both are configured to not select past dates but I need to apply condition to the second based only on Dates After the First Picked Date.

    How to validate two dates using conditions?  Image 1 Screenshot 30

     

    So I can avoid receiving this kind of error:

    How to validate two dates using conditions?  Image 2 Screenshot 41

     

    I explore the Conditions Options but not find like a "After Picked Date" or something similar

     

    Thanks a lot!

  • Kevin Support Team Lead
    Replied on February 29, 2016 at 4:16 PM

    Please follow these steps:

    1. Add a "Form Calculation Widget" to your form.

    How to validate two dates using conditions?  Image 1 Screenshot 70

    2. In the widget add this subtraction, "Fecha de Salida" - "Fecha de Regreso".

    How to validate two dates using conditions?  Image 2 Screenshot 81

    3. Add a text to indicate your users that "Fecha de Regreso" could not be less than the "Fecha de Salida". 

    How to validate two dates using conditions?  Image 3 Screenshot 92

    4. Set the Form Calculation and the text as hidden.

    How to validate two dates using conditions?  Image 4 Screenshot 103

    How to validate two dates using conditions?  Image 5 Screenshot 114

    5. Now add this conditions, total is the result of the subtraction, if it is less than 0 then it will show the message and will hide the submit button.

    How to validate two dates using conditions?  Image 6 Screenshot 125

    Take a look on my sample form: https://form.jotform.com/53097140976967.

    Feel free to clone it.

    Hope this helps.

  • traveldiunsa
    Replied on March 1, 2016 at 2:58 PM

    ¡Thanks for the help!
    I just apply the changes in http://traveldiunsa.com/boletos-aereos/  
    I knew you would have a tweak to make it happen.

  • jonathan
    Replied on March 1, 2016 at 4:29 PM

    Can we assume that all is good now?

    I checked the form http://www.jotform.co/form/50686448502863   on your website, and I see the condition working similar to the solution suggested by our colleague.

    How to validate two dates using conditions?  Image 1 Screenshot 20

    Let us know if there is more we can help you with.

    Thanks.

  • traveldiunsa
    Replied on March 1, 2016 at 4:31 PM

    Yes, you can mark it Solved, thanks for the help!

  • jonathan
    Replied on March 1, 2016 at 5:34 PM

    Thank you for the confirmation. On behalf of my colleague you are welcome as well :-)

    Cheers