-1

I am trying to validate a number that not is required but the native method don't allow this.

There is a way to override the native method or I have to add a custom method?

Edit

<input class="form-control" data-val="true" data-val-number="The field Foo must be a number." id="Foo" name="Foo" type="text" value="">

Note: this is generated by asp.net mvc

1 Answers1

0

this work for me

  $(function() {
        $.validator.methods.number = function (value, element) {
            return !value || Globalize.parseFloat(value).toString() != "NaN";
        }
  }