asp.net mvc 3 - client validation using jQuery validate for currency fields -


i have problem using jquery.validate on asp.net mvc 3 app.

at least in spain use "," split number decimals. ok, using server side validation, if put like:

12.55 when server validate it, says value not valid. if put: 12,55 works.

so far good, if use jquery validate, says 12,55 invalid , 12.55 valid one. so, client pass validation server not, or client doesnt pass server would.

so... can change locale kind of validation?

thank you.

ps: how server knows want validate using "," , not "."? don't remember if specified somewhere.

probably should include localization files:

http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/localization/messages_es.js

http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/localization/methods_de.js

in germany 1 uses same rules numbers, can use methods_de.js or include

jquery.extend(jquery.validator.methods, {     number: function(value, element) {         return this.optional(element) ||                /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);     } }); 

here list of files hosted microsoft cdn version of 1.6. version 1.7 has the same files.

updated: see demo here.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -