Language

EditContext.OnValidationRequested Event

Definition

An event that is raised when validation is requested. Validator components subscribe to this event to perform validation.

public:
 event EventHandler<Microsoft::AspNetCore::Components::Forms::ValidationRequestedEventArgs ^> ^ OnValidationRequested;
public event EventHandler<Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs>? OnValidationRequested;
public event EventHandler<Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs> OnValidationRequested;
member this.OnValidationRequested : EventHandler<Microsoft.AspNetCore.Components.Forms.ValidationRequestedEventArgs> 
Public Event OnValidationRequested As EventHandler(Of ValidationRequestedEventArgs) 
Public Custom Event OnValidationRequested As EventHandler(Of ValidationRequestedEventArgs) 

Event Type

Remarks

Handlers run synchronously in subscription order. A validator that performs asynchronous work keeps its handler synchronous and registers an async validator via AddAsyncValidator(Func<CancellationToken,Task>), for example (sender, args) => args.AddAsyncValidator(token => ValidateAsyncCore(token)). ValidateAsync(CancellationToken) invokes every registered validator and awaits the resulting tasks; Validate() throws InvalidOperationException if a handler registers asynchronous work. Do not use an async void handler: its work is not awaited and is silently skipped.

Applies to