Last post Aug 23, 2012 07:49 AM by alexbeloff
Aug 20, 2012 08:56 PM|alexbeloff|LINK
I've got CurrentUICulture set to the required culture and I use jquery ui datepicker on the client which is also set to the required culture. The only problem I have with unobtrusive validation functionality for DateTime field. It gives me
The field DateTaken must be a date.
But the format is right!
How do I make it to take the culture into account?
Aug 21, 2012 04:33 AM|mitja.GTI|LINK
You would need to provide more information about your date format. Meanwhile you can
look at this post and this.
Aug 21, 2012 09:27 AM|francesco abbruzzese|LINK
Probably there is a culture mismatch between various components. For instance maybe that the culture selected for the datetimepicker is not the same for the culture selected for the unobtrusive validation.
In order to support Globalization for the datetimepicker you just need to add the globalization script, as explained in the doc for the datetimepicker. In order to enable globalization for unobtrusive validation you need to use the globalize library and
need to add some js script to connect it to the js unobtrusive validation module.
In this post of my blog you will find all scripts needed to put in place globalization for datetimepicker and unobtrusive validation,
and to reflect the culture selected on the server in this two plugins. The last step ensures that all modules use the same culture, so there cant be culture mismatches.
Anyway you message is strange...because Mvc doesnt enable unobtrusive validation of dates, so how have you enabled unobtrusve validation for dates? Manually? Does the above error message is a custom error message inserted by you?
Aug 23, 2012 03:44 AM|Angie xu - MSFT|LINK
If you want to globalize unobtrusive jQuery valdiation in your ASP.NET MVC, please refer to the article that globalizing ASP.NET MVC unobtrusive validation:
Hope it helpful to you.
Aug 23, 2012 07:49 AM|alexbeloff|LINK
ok, I've done it myself. I'm at work now so I'll post the code later today.