triina / FunForFisherman

1 stars 0 forks source link

Intercultural Awareness #3

Closed eugene-doe closed 10 years ago

eugene-doe commented 10 years ago

The application in its current state behaves quite strangely when it comes to culture-dependent formats, like decimals, for instance: it allows input neither with commas nor with periods, so something must be done to make it functional. Tomi said he knows the solution, so I'm waiting for his help, but I've got a temporary workaround too: the culture in Web.config is now set to en-US.

eugene-doe commented 10 years ago

So... the main problem was with the client-side validator, which did not work correctly in cultures that use comma as decimal separator. It is the jquery.validate.js script that was causing the problem. The issue is well-known, and there is a bunch of solutions on the net, but all of them seemed too complex except one. That one now resides in jquery.validate.fix.js, which must be loaded after the original jquery.validate -- and in our case it means after the jqueryval bundle. Views with no decimal input don't need the fix.

I've included a comment in jquery.validate.fix.js, which I will reproduce here for convenience: "This is a standard solution obtained from the net. It has a downside in that it accepts both . and , as valid inputs, but at least it works, and server-side validation then takes care of any values inconsistent with CurrentCulture."