1

I have a number of fields I need to validate together. I need to check the sum of A+B+C = the sum of D+E.

If the sum of these two groups is not equal, I need to highlight all 5 fields. I can't seem to find a way to validate multiple properties together.

At FluentValidation rule for multiple properties , @Matías Romero suggests using something like

RuleFor(m => new {m.CountyId, m.Zip}).Must(x => ValidZipCounty(x.Zip, x.CountyId))
                                  .WithMessage("Wrong Zip County");

This doesn't seem to highlight the invalid fields though. Is this possible with Fluent Validation (MVC5)?

Echilon
  • 10,064
  • 33
  • 131
  • 217

0 Answers0