What is the difference between OnValidSubmit and OnSubmit in Blazor forms?

Last updated 5 July 2026

Both are EditForm submit callbacks, but they differ in who owns validation: OnValidSubmit fires only after validation passes, while OnSubmit fires on every submit and hands you the full validation responsibility.

  • OnValidSubmit (and OnInvalidSubmit):

    • Blazor runs validation first; OnValidSubmit runs only if the model is valid, OnInvalidSubmit only if it isn't.

    • Use this for the common case: let the framework validate, you just handle success.

  • OnSubmit:

    • Fires on every submit regardless of validity; you must call editContext.Validate() yourself.

    • Use it when you need full control over the validation flow.

  • Mutually exclusive: Provide either OnSubmit or the OnValidSubmit/OnInvalidSubmit pair, not both.

  • https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation?view=aspnetcore-10.0
  • https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/?view=aspnetcore-10.0
  • https://blazor-university.com/forms/handling-form-submission/
  • https://www.telerik.com/blazor-ui/documentation/components/form/events
All Blazor interview questions