Unobtrusive user / conditional validation with Fluent Validation

I'm looking for a way to implement unobtrusive custom validation for Fluent Validation. According to the documentation , it does not seem to indicate that it supports unobtrusive validation.

The same applies to using conditional validation ( When / Unless ). I see in my MVC documentation , unobtrusive validation is not supported with conditional and other complex validation:

Note that FluentValidation will also work with ASP.NET MVC client-side validation, but not all rules are supported. For example, any rules defined by a condition (with / without), custom validators, or Must calls will not be executed on the client side. The following validators are supported on the client:

* NotNull / NotEmpty
* Matches (regular expression)
* InclusiveBetween (range)
* CreditCard
* E-mail
* EqualTo (mutual match comparison)
* Length

So did anyone figure out how to make this work? If not, are there other validation options that provide better support for unobtrusive user / integrated validation?

+5
1

FluentValidation ASP.NET MVC 3, ASP.NET MVC docs.

FluentValidation MVC Validation Global.asax Application_Start() :

FluentValidationModelValidatorProvider.Configure();

POCO , .

[Validator(typeof(PersonValidator))]
public class Person {
    public int Id { get; set; }
    public string Name { get; set; }
    public string Email { get; set; }
    public int Age { get; set; }
}

( ) POCO , -.

, factory IoC". FluentMvcValidatorFactory ValidatorFactoryBase, IValidatorFactory. factory .

( ), , , . html :

<input type="text" value="" name="Email" id="Email" data-val-length-max="128" data-val-length="&amp;#39;Email&amp;#39; must be between 0 and 128 characters." data-val-email="&amp;#39;Email&amp;#39; is not a valid email address." data-val="true" class="text-box single-line">

MVC, , .

, . , .

+1

All Articles