We have an Umbraco Form with a mandatory DatePicker field.
Have discovered that users can enter random text into this field eg "hgjfjk" and it passes validation, although the data is not saved and so does not appear in any of the workflow emails.
How do we ensure that only valid dates are accepted?
Tested the same thing just now and you are right, the forms gets sent but the input from det datefield is lost. Since there is now option for Regex on the Datepicker field one cant solve it that way either.
So I recently had this and I solved it quite easily:
In the partial FieldType.DatePicker on the input add the following attributes:
data-msg-date="The field DateTime must be a date." data-rule-date="true"
Jquery validation will do its magic.
Im guessing server side you will still have issue but at least its better than having no validation at all.
Mandatory datepicker allows non-date text
We have an Umbraco Form with a mandatory DatePicker field.
Have discovered that users can enter random text into this field eg "hgjfjk" and it passes validation, although the data is not saved and so does not appear in any of the workflow emails.
How do we ensure that only valid dates are accepted?
Hi Lesley!
Tested the same thing just now and you are right, the forms gets sent but the input from det datefield is lost. Since there is now option for Regex on the Datepicker field one cant solve it that way either.
Maybe you should report this to the issue tracker: http://issues.umbraco.org/issues
(I used Umbraco version 7.4.2 with the latest version of Forms)
Thanks Dennis,
Have reported this to the issue tracker:
http://issues.umbraco.org/issue/CON-953
Hi again Lesley!
Great, than you´ll probobly be contacted soon about this. Hope that it workes out for you.
You could fix it in the meantime with just simple Regex validation, but since its only clientside and no severside validation, its not bullet proof.
So I recently had this and I solved it quite easily:
In the partial FieldType.DatePicker on the input add the following attributes: data-msg-date="The field DateTime must be a date." data-rule-date="true"
Jquery validation will do its magic.
Im guessing server side you will still have issue but at least its better than having no validation at all.
Regards
Ismail
the above works, but the validation seems to accept only MM-DD-YYYY value. if you put in a normal date (DD/MM/YYYY) it doesnt let you pass.
Will check if there is something under the hood that i can change. (config)
you may need this for non american dates, in addition to the above.
i've added it to the DatePicker view. i suppose you can put it anywhere.
is working on a reply...