I use fluent validation for client side validation of my mudform:
<MudBlazor.MudForm Model="person" @onsubmit="ValidSubmit" @ref="frmMain"
@bind-Errors="@errors" OverrideFieldValidation="true"
Validation="@(modelValidator.ValidateValue)">
sometimes in the fluent validation codes I use this to disable it:
RuleFor(x => x.User.UserName)
.MaximumLength(50).When(x => (Person != null && Person.User != null && UserEditable))
.WithMessage("...");
when I use the page and disable client fluent validation and submit. Then the dataannotation validation takes effect:
[StringLength(50)]
public string UserName { get; set; } = string.Empty;
This is an unwanted behavior and I want only fluent validation work, I want the data annotation for server validation but don't want the annotation effect on the client, only MudBlazor fluent validation on the client.
This is the MudTextField that uses this validation:
<MudBlazor.MudTextField Label="User Name"
For="(() => person.User.UserName)" @bind-Value="Person.UserName" Class="mb-4 d-block w-100" Immediate="true"
Variant="MudBlazor.Variant.Text"
autocomplete="new-password"
Disabled="!IsEditable">
</MudBlazor.MudTextField>
So how to correct this?