MVC 3 client side validation, model binding decimal value and culture (different decimal separator)

后端 未结 3 1713
一向
一向 2020-12-14 03:45

I am trying to have my client side validation (model binding) to support different cultures, and I found an interesting blog on the subject on which I am trying to implement

3条回答
  •  一个人的身影
    2020-12-14 04:20

    I've just fixed this issue replacing the line 1050 of the jquery.validate.js with this code:

    return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:[.|\,]\d+)?$/.test(value);

    I've just changed smth on the regular expression used to validate the number and now it's working great!!

提交回复
热议问题