- tdklahrAsked 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.Page URL:
- JotForm SupportNik_CAnswered on July 29, 2016 at 06:09 PM
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.
- tdklahrAnswered on July 30, 2016 at 02:12 PM
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?
- JotForm SupportNik_CAnswered on July 30, 2016 at 03:39 PM
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.
- tdklahrAnswered on July 30, 2016 at 08:05 PM
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?
- tdklahrAnswered on July 30, 2016 at 08:08 PM
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.
- JotForm SupportNik_CAnswered on July 31, 2016 at 04:39 AM
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.
- tdklahrAnswered on July 31, 2016 at 02:32 PM
Nik, thanks very much! The lite version is working for me. I appreciate all you help!