MVC with Fluent validation when set a rule the view doesn’t validate

I include the rule for my model, but when I do it then view doesn’t validate. If I remove the rule the view validate correctly.

The problem is that the razor doesn’t include the validation on the model when I include the rule in the validator.

This is the model with the rule:

public class LoginModelValidator : AbstractValidator<LoginModel>
{
    public LoginModelValidator()
    {
        RuleSet("login", () =>
        {
            RuleFor(model => model.Email)
                .NotNull()
                .EmailAddress();

            RuleFor(model => model.Password).NotNull();
        });

        /*
        RuleSet("forgotpass", () =>
        {
            RuleFor(model => model.Email)
                .NotNull()
                .EmailAddress();
        });
        */
    }
}

When send the request, in the action I include:

[CustomizeValidator(RuleSet="login")]

for validate the rule login and it work find. The problen is in the view.


Download mvc.with.fluent.validation.when.set.a.rule.the.view.doesnt.validate.zip
Direct Link


Download


Download mvc.with.fluent.validation.when.set.a.rule.the.view.doesnt.validate.zip
Mediafire


Download


Download mvc.with.fluent.validation.when.set.a.rule.the.view.doesnt.validate.zip
Anafile


Download


Download mvc.with.fluent.validation.when.set.a.rule.the.view.doesnt.validate.zip
Hulkload


Download


Download mvc.with.fluent.validation.when.set.a.rule.the.view.doesnt.validate.zip
Uploadbaz


Download

Both comments and pings are currently closed.

Comments are closed.