What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.
At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.
We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.
validation of two dates (from-to)Asked by unicefethiopia 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?
two dates validate thanks hello
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.
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?
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.
Thanks. it worked well after i cloned your form and checked the conditions.
I'm glad to hear it. If you need further support please let us know.