This repository was archived by the owner on Dec 26, 2025. It is now read-only.
Problem: FluentValidator with Blazor WASM #196
Unanswered
pauljohan1
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
roblem: FluentValidator with Blazor WASM code:
If I save new entry(Id=0, DataContext is empty), it works
When I do Update(Id > 0, DataContext is not empty) FluentValidation doesn't work, Validation is always true in HandleValidSubmit().
Can I use EditContext="@EditContext" instead of EditForm Model="modelname" ?
EditForm EditContext="@EditContext">
FluentValidationValidator @ref="_fluentValidationValidator" Options="@(options => options.IncludeRuleSets("M1"))" />
Code:
();Main main = new Main() { };
protected override async Task OnInitializedAsync()
{
if (Id > 0)
{
var response = await new HttpClient().PostAsJsonAsync("https://localhost:7195/write/findmainupdate", new SimplePost { intArg = (long)Id });
main = await response.Content.ReadAsAsync
editContext = new(main);
}
else
{
editContext = new(main);
}
Beta Was this translation helpful? Give feedback.
All reactions