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.
Date field: Year field is not validating properlyAsked by tdklahr on July 29, 2016 at 04:57 PM
I have created a form with a Date field. If I enter a value in the month, day or year fields, but then don't complete the date (leave the month or day blank), the form displays an alert that the date is not valid. That is all good. However, if I enter a month and day, but leave the year blank, there is no alert and I am able to submit the form.
Why is the year field not included in the validation, and how can I fix this?
For example if I enter "1" for the month, "1" for the day, and leave the year field blank, I do not get an alert.
date field validating
I cloned your form, tested and I was unable to replicate this issue you are describing, you can check my screencast below:
As you can see message pops up with all fields.
Please test and get back to us if you are experiencing the same issue.
Thanks Nik, but on my form I am not seeing that same behavior. Just tried it again and if I leave the year field blank, there is no error message displayed. In the picture I clicked out of the date field and into the text box, but no error! Do you have any suggestions?
I'm sorry, but your Date field is not required in your form, there is no asterisk near that field:
When you enable it, there is no reason why it shouldn't work, I just tested again and it is working fine, please check and let me know how that worked.
ok that did work. But I don't want the field to be required. However, if someone DOES try to enter a date, the date should be a valid one. I thought that is how it would work, because if I leave the Month or Day fields empty (without the field being required), I get the error message (see screenshot). But then if I leave the Year field empty, no error. Do you know if there is a way to validate the whole Date field is a date, without the field being required?
And actually it appears the Year isn't being validated anyway. If I make the field required, but put in an invalid year, no error.
I'm very sorry for this misunderstanding. I see what you're referring to, and you're right it is not validating properly.
I will forward this to our developers for further checking. In the meantime, if it works for you, you can use date field in lite mode. To do that please follow:
As you can see it will validate properly so nobody can enter invalid date.
Regarding the format that doesn't validate properly, we will inform you through this thread about the outcome.
Nik, thanks very much! The lite version is working for me. I appreciate all you help!