Include support for conditional validation
Often times it is necessary to perform a validation only under a certain condition, X is Required IF Y is checked...etc.
10 comments
-
Peter
commented
Also decouple unbinding from validation, make it two separate calls. Sometimes I just want unbind without validation, or just want to validate certain fields or groups of fields.
-
Wayne Brantley
commented
Sure hope they get around to a better validation story before too long. What currently exists is great for simple demos, but really needs help.
-
jon
commented
what about multiple custom validator on a property as mvc is providing multiple custom validator on class right now ?
-
grahamoneale commented
How about conditional validation (both client & server) depending on what page you're on? For instance, if I have a User Add page I might validate Password, but if it's the User Edit page, password validation is not required. I would have thought this is a fundamental requirement, but it seems it's not supported.
But I agree with the guys, I think this needs to be achieved using a Fluent Validation style approach with RuleSets.
-
Lobstrosity
commented
What would this provide that IValidatableObject doesn't? Or is it just a matter of usage?
-
Yitzhak Khabinsky
commented
Very practical and important functionality.
-
Wayne Brantley
commented
Be very nice if something like FluentValidation was baked in. For example, how can you validate a date field such that the max date allowed is 'today'. Cannot do it - because everything is statically defined in the current validation implementation.
-
Travis Illig
commented
It'd be nice if something as flexible as FluentValidation got baked in.
-
M. Keith Warren
commented
I get that it is simple to implement and I have done one for my personal projects but I think it makes a good candidate for being baked into the bits.
-
Zote commented
It's very simple to implement this. You can get some sample at Brad Wilson's blog. Or, if you need, I can help you.