I suggest you ...

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.

428 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    M. Keith WarrenM. Keith Warren shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    10 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • PeterPeter commented  ·   ·  Flag as inappropriate

        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 BrantleyWayne Brantley commented  ·   ·  Flag as inappropriate

        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.

      • jonjon commented  ·   ·  Flag as inappropriate

        what about multiple custom validator on a property as mvc is providing multiple custom validator on class right now ?

      • grahamonealegrahamoneale commented  ·   ·  Flag as inappropriate

        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.

      • LobstrosityLobstrosity commented  ·   ·  Flag as inappropriate

        What would this provide that IValidatableObject doesn't? Or is it just a matter of usage?

      • Wayne BrantleyWayne Brantley commented  ·   ·  Flag as inappropriate

        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.

      • M. Keith WarrenM. Keith Warren commented  ·   ·  Flag as inappropriate

        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.

      • ZoteZote commented  ·   ·  Flag as inappropriate

        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.

      Feedback and Knowledge Base