ASP.NET MVC 3 and the jquery.validate.unobtrusive.js won't respect culture format - by toebens2

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


22
0
Sign in
to vote
ID 645066 Comments
Status Closed Workarounds
Type Bug Repros 13
Opened 2/18/2011 2:13:40 AM
Access Restriction Public

Description

hello,
there seems to be a bug with MVC 3 and the jquery.validate.unobtrusive.js:

I'm developing a german asp.net mvc 3 website and have included the jquery script:
   -jquery-1.4.4.min.js
   -jquery.validate.min.js
   -jquery.validate.unobtrusive.min.js
in this order.

the web.config has add key="UnobtrusiveJavaScriptEnabled" value="true" (as well as globalization culture="de-DE" uiCulture="de-DE")

if i enter some german formated number like "1,2" into a textbox for a model property (of type double) i get a validation error: "The field THENAMEOFPROPERTY must be a number." ("1.2" is working)

if i disable UnobtrusiveJavaScriptEnabled by setting key="UnobtrusiveJavaScriptEnabled" value="false" in web.config there is no validation error and it is working correctly.

i also tried using the jquery globalization plugin but the jquery validation plugin doesn't seem to use it (please also have a look at http://stackoverflow.com/questions/4472821/asp-net-mvc-3-rc-2-client-side-validation-with-globalization too)

thanks, toebens
Sign in to post a comment.
Posted by Microsoft on 9/13/2011 at 1:49 PM
Hi everyone,

While ASP.NET MVC doesn't use the jQuery Validate globalization features out of the box, it's quite easy to add the functionality to the sites and apps that you're building.

One of our documentation writers, Rick Anderson, wrote a blog post on how to get this all working:
http://blogs.msdn.com/b/rickandy/archive/2011/02/17/using-mvc-3-with-non-english-locales.aspx
Some of the content is also on MSDN:
http://msdn.microsoft.com/en-us/library/gg674880(v=vs.98).aspx
And our prolific blogger Scott Hanselman wrote an article recently as well:
http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx

We're also looking to make this work better out of the box, but for now these easy solutions should get you started.

Thanks,
The ASP.NET Team
Posted by Microsoft on 2/18/2011 at 2:58 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)