- unicefethiopiaAsked on June 30, 2014 at 10:15 AM
I have a form where two dates should be entered (from - to) . The "To" date should be after the "From" date.
Is it possible to validate the second date to later than the first date?
- CarinaAnswered on June 30, 2014 at 11:46 AM
I tried a workaround using 3 form calculation fields. In the "from" calculation field I added the date "from" and did the same with the "to" field.
I added a third calculation field (total) where I would subtract the calculation fields "to" - "from":
I also added a Text field, under Form Tools with a warning message that will show if the "to" date is after the "from" date.
I added a condition that if "total" is less than 0 show "error message":
You can clone the test form if you wish:
Let us know if this is a solution for you.
- unicefethiopiaAnswered on July 02, 2014 at 04:53 AM
Hi, thanks for the solution,
The only difference is the error message but it does not prevent submission of the form!
Is there a way to prevent the submission?
- JotForm SupportjonathanAnswered on July 02, 2014 at 08:31 AM
You can just use the condition to hide the Submit button if the selected dates is true.
Example, if date FROM is after date TO which is false -- then hide submit button. This will prevent form submission base on condition.
I also created a demo form http://www.jotform.me/form/41823271891457
It only requires the From and To date field to calculate (lesser field requirement)
The calculation is like this
If you test the form, you will not be able to submit if the TO date is less than FROM date.
Inform us if you need more assistance.
- unicefethiopiaAnswered on July 03, 2014 at 03:29 PM
Thanks. it worked well after i cloned your form and checked the conditions.
- CarinaAnswered on July 03, 2014 at 04:22 PM
I'm glad to hear it. If you need further support please let us know.