You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for a way to silently validate an EditContext when using FluentValidation, i.e. Validate without generating ValidationMessages. This feature is quite useful, e.g. to disable/enable a submit button.
bool FormIsValid()
{
var validationResults = new List<ValidationResult>();
var validationContext = new ValidationContext(EditContext.Model);
Validator.TryValidateObject(EditContext.Model, validationContext, validationResults, true);
return !validationResults.Any();
}
Unfortunately I don't fully understand the way FluentValidation is hooked up into EditContext, but perhaps someone had an idea or already implemented something similiar and can get me on the right track.
Thanks in advance
Jake
The text was updated successfully, but these errors were encountered:
Hi,
I'm looking for a way to silently validate an EditContext when using FluentValidation, i.e. Validate without generating ValidationMessages. This feature is quite useful, e.g. to disable/enable a submit button.
When using DataAnnotationsValidator this is possible by calling Validator.TryValidateObject() like:
Unfortunately I don't fully understand the way FluentValidation is hooked up into EditContext, but perhaps someone had an idea or already implemented something similiar and can get me on the right track.
Thanks in advance
Jake
The text was updated successfully, but these errors were encountered: