Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion aspnetcore/blazor/forms/validation-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@ To implement a business rule inside the validator component instead of accepting

The same component pattern supports asynchronous work:

<!-- UPDATE 11.0 - API Browser cross-ref

<xref:Microsoft.AspNetCore.Components.Forms.EditContext.RegisterAsyncFieldValidator%2A>
-->

* In an `OnValidationRequested` handler, call `e.AddAsyncValidator` to register form-level work. `EditForm` awaits it before invoking `OnValidSubmit` or `OnInvalidSubmit`.
* In an `OnFieldChanged` handler, call <xref:Microsoft.AspNetCore.Components.Forms.EditContext.RegisterAsyncFieldValidator%2A> to start validation for that field. Starting another validation for the same field supersedes and cancels the previous operation.
* In an `OnFieldChanged` handler, call `EditContext.RegisterAsyncFieldValidator` to start validation for that field. Starting another validation for the same field supersedes and cancels the previous operation.

For form-level asynchronous validation:

Expand Down
7 changes: 6 additions & 1 deletion aspnetcore/blazor/forms/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,12 @@ Static SSR doesn't provide live .NET field validation between requests.

:::moniker range=">= aspnetcore-11.0"

For asynchronous full-form validation, call `e.AddAsyncValidator` from an `OnValidationRequested` handler. For asynchronous field validation in an interactive form, call <xref:Microsoft.AspNetCore.Components.Forms.EditContext.RegisterAsyncFieldValidator%2A> from an `OnFieldChanged` handler. A new asynchronous validation for the same field supersedes and cancels the previous one.
<!-- UPDATE 11.0 - API Browser cross-ref

<xref:Microsoft.AspNetCore.Components.Forms.EditContext.RegisterAsyncFieldValidator%2A>
-->

For asynchronous full-form validation, call `e.AddAsyncValidator` from an `OnValidationRequested` handler. For asynchronous field validation in an interactive form, call `EditContext.RegisterAsyncFieldValidator` from an `OnFieldChanged` handler. A new asynchronous validation for the same field supersedes and cancels the previous one.

For model-based asynchronous validation attributes, see <xref:fundamentals/validation#asynchronous-validation-support>. For a complete reusable validator component, see <xref:blazor/forms/validation-advanced>.

Expand Down
Loading