Hi Richard,

I also live in the Netherlands and ran into the same problem. I couldn't
find an answer online so i decided to write some addon methods myself.
I added the following two methods to the validator and that did the trick.

$.validator.addMethod("maxNL", function(value, element, param) {
    var val = value.replace(",", ".");
    return this.optional(element) || val <= param;
}, jQuery.validator.format("Vul hier een waarde in kleiner dan of gelijk aan
{0}."));

$.validator.addMethod("minNL", function(value, element, param) {
    var val = value.replace(",", ".");
    return this.optional(element) || val >= param;
}, jQuery.validator.format("Vul hier een waarde in groter dan of gelijk aan
{0}."));

It doesn't do much more than replace a comma with a period and validate the
new value.
Hope this helps.
Note that this probably doesn't work for numbers greater than 1000 with
formatting (for example, 1.000,00). In that case you have to switch the
period for a comma and the comma for a period.

Greets,
Bart


Richard-330 wrote:
> 
> 
> Hi,
> 
> I was working with validation, but am having problems using the method
> "max" for maximal numbers. I live in Holland and for us the decimal
> character is a comma, and I can use comma's for validating the max
> value of a field.
> Could someone please make an addon like "numberDE" for max? So i can
> check comma's.
> 
> Thanks!
> 
> Richard
> 
> 

-- 
View this message in context: 
http://old.nabble.com/jQuery-Validation-request-tp25995270s27240p26160052.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to