Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge need for a bridge between jquery.global and jquery.validate #55

Closed
Strato opened this issue Mar 10, 2011 · 3 comments
Closed

Huge need for a bridge between jquery.global and jquery.validate #55

Strato opened this issue Mar 10, 2011 · 3 comments

Comments

@Strato
Copy link

Strato commented Mar 10, 2011

Hello,

My team is developing an e-commerce framework in ASP.Net MVC. Recently we upgraded it to MVC 3, and I have spent a large part of the day testing the new jquery.validate/unobtrusive javascript goodness.

All in all, it went pretty smooth, but our framework is intended to be multi-language oriented (or at least french oriented), and the need for a localization library came quickly. Previously we were using the Ajax.GlobalizationScript and the MicrosoftAjaxMvcValidation libraries, which were a little bit limited, but worked well.

I was excited by the possibility to use jquery.validate and all its neat features, but... it's proving very difficult to use it on an international website. Of course I expected jquery.global to come to the rescue, but it's not very easy. For example : validation of comma separated decimal numbers (which are default in french). A lot of forums like StackOverflow are giving this little trick :

jQuery.validator.methods.number = function (value, element) {
    return !isNaN(jQuery.global.parseFloat(value));
}

It works quite well, but actually you need to do that kind of "bridging" with all methods that parse possible decimal numbers (like range validation).

I'm seeing there is a jquery.validate 2.0 in the tubes, and I don't know what will come with it, but it would be great to be able to link it to a couple of localization parsing methods like the ones jquery.global is exposing.

In the meantime, keep up the good work!

@fbuchinger
Copy link
Contributor

I second your wish for a jquery globalize/i18n integration for jquery validate. The delegation of the locale-specific parsing (Dates, numbers etc) to a specialized library is surely a superior solution compared to validate's "roll-your-own" approach of the past (with validators like dateDE).

Any news on this subject?

@johnnyreilly
Copy link
Contributor

Hi Strato,

I'm sure you've solved the problem by now but since I've recently been implementing a solution to this very issue myself I thought I'd share it. I started by following the advice in Scott Hanselman's blog on this topic - you can read about this here:

http://www.hanselman.com/blog/GlobalizationInternationalizationAndLocalizationInASPNETMVC3JavaScriptAndJQueryPart1.aspx

I had to make some changes to use Globalize instead of jQuery Global (now jQuery Global is dead). I wrote this up in the following blog post in case that's helpful:

http://icanmakethiswork.blogspot.co.uk/2012/09/globalize-and-jquery-validate.html

@jzaefferer
Copy link
Collaborator

Duplicate of #581 - this is older, but there are more references to the newer ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants