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 want to be able to validate Prop1.ChildProp and Prop2.ChildProp using different validation rules. E.g.:
<EditFormModel="model"><FluentValidatorValidator="new ModelValidator()" /><InputText@bind-Value="model.Prop1.ChildProp" /><ValidationMessageFor="() => model.Prop1.ChildProp" /><InputText@bind-Value="model.Prop2.ChildProp" /><ValidationMessageFor="() => model.Prop2.ChildProp" /></EditForm>
@code
{
Model model = new Model();
public class ModelValidator: AbstractValidator<Model>
{
RuleFor(() => Prop1.ChildProp).NotEmpty();
RuleFor(() => Prop2.ChildProp).Empty();
}
}
The problem is, that FieldIdentifier for Prop1.ChildProp does not contain the information, whether we are editing Prop1 or Prop2, so there is do way to know, which rule to apply.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Consider following model:
I want to be able to validate Prop1.ChildProp and Prop2.ChildProp using different validation rules. E.g.:
The problem is, that
FieldIdentifier
forProp1.ChildProp
does not contain the information, whether we are editing Prop1 or Prop2, so there is do way to know, which rule to apply.Beta Was this translation helpful? Give feedback.
All reactions