2

I hope someone can help me out to disable the default validation that MVC 3 runs when I post a string value in an integer field. Currently the application will add the error “the value ‘abc’ is not valid for IntergerProperty” to the ModelState before our validators are executed.

We don’t use client side validation and have our own validators that are loaded in the Global.asax. We only want to use these validators to check the input and would like to disable this check.

Is it possible to disable this behavior?

Thanks in advanced,

André

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
  • See http://stackoverflow.com/questions/3578781/disable-model-validation-in-asp-net-mvc for a solution – Rob West Oct 16 '12 at 11:54
  • 1
    An easier option is to clear the model state errors. The other option is to go for a custom model binder and possibly you have to override SetProperty method where they do the type check (I guess) but it is more work. – VJAI Oct 16 '12 at 12:07

1 Answers1

0

I think the best solution for your issue is to implement a custom model binder to override the default behavior if you really want/need to be able to take alpha chars in a numeric field.

Travis
  • 41
  • 4