0

Am having the model and added validation using Annotations. Validation was working fine till i updated to FireFox 30.0

Even my friend firefox browser renders the same code correctly.

  [Range(-10000, 200000)]
    [Integer] //From Annotaiton Extensions
    public int? someint { get; set; }

In my View if have

@Html.TextBoxFor(model => model.someint)  //validation works fine

@Html.EditorFor(model => model.someint)   // validation not working (eg: if i enter any char like "eer" , no validaition is fired)

Is it just me or any body else facing it ? Any workarounds ?

But everything works in IE8 :)

Peru
  • 2,871
  • 5
  • 37
  • 66

2 Answers2

0

Try this :

   [Range(-10000, 200000)]
   [RegularExpression("^[0-9]*$", ErrorMessage = "Please enter numeric value..!")]
   public int? someint { get; set; }

Hopefully it works...!

Amit
  • 823
  • 7
  • 13
0

There is some problem in the jQuery verison 1.9.1, if you are using this version of jQuery please update following:

jQuery Validation (at least 1.11.1)

if you are using then following as well:

Microsoft jQuery Unobtrusive Validation (at least 2.0.30116.0)

Microsoft jQuery Unobtrusive Ajax (at least 2.0.30116.0)

After this updation Range validation should work in Firefox or any other browser.

More detail can be found here

Community
  • 1
  • 1
Manish Kumar
  • 125
  • 1
  • 2
  • 8