Skip to content

Minor Blazor form validation improvements - #37735

Merged
guardrex merged 3 commits into
mainfrom
oroztocil/validation-docs-nits
Sep 24, 2026
Merged

guardrex merged 3 commits into
mainfrom
oroztocil/validation-docs-nits

Conversation

@oroztocil

@oroztocil oroztocil commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

A few small additions and phrasing improvements I realized I want to do after reading through the docs on the live website.

Summary

  • Documents that replacing EditForm.Model resets modification and validation state.
  • Explains how ValidationMessage.For identifies fields through FieldIdentifier.
  • Shows how to apply validation classes to surrounding markup with EditForm.Context and FieldCssClass.
  • Adds a property-level AsyncValidationAttribute example with dependency injection, cancellation, member association, and synchronous fallback.

Verification

  • The new .NET 11 async validation example builds with zero warnings and errors.

Internal previews

File Preview link
aspnetcore/blazor/forms/binding.md Learn preview
aspnetcore/blazor/forms/validation.md Learn preview
aspnetcore/fundamentals/validation.md Learn preview

Build report

@oroztocil
oroztocil requested a balanced review from Copilot September 23, 2026 14:51
@oroztocil
oroztocil marked this pull request as ready for review September 23, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The fundamentals article needs its metadata date updated, and one spacing error remains.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 2 Low severity

Open (2)
What changed in this PR

Improves Blazor form validation guidance and adds a .NET 11 asynchronous validation example.

Changes:

  • Documents EditContext lifecycle and field identity.
  • Demonstrates CSS classes on surrounding markup.
  • Adds property-level asynchronous validation.
File Description
aspnetcore/​blazor/​forms/​binding.md Explains model replacement behavior.
aspnetcore/​blazor/​forms/​validation.md Clarifies field identity and CSS styling.
aspnetcore/​fundamentals/​validation.md Adds an asynchronous validation attribute example.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread aspnetcore/blazor/forms/validation.md Outdated
Comment thread aspnetcore/fundamentals/validation.md
@oroztocil

Copy link
Copy Markdown
Member Author

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

Co-authored-by: oroztocil <79744616+oroztocil@users.noreply.github.com>

Copilot AI commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, a...

Fixed in 8a1d922: removed the extra space before Context and updated ms.date to 09/23/2026 in fundamentals/validation.md.

@guardrex guardrex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny XREF change spotted.

Comment thread aspnetcore/blazor/forms/validation.md
@guardrex

Copy link
Copy Markdown
Collaborator

BTW ... I'm trying to get my XREF gen tool fixed. Can you provide an approval on ...

dotnet/blazor-samples#671

... and then it will start working properly again ...

https://dotnet.github.io/blazor-samples/

@guardrex guardrex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@guardrex
guardrex merged commit 273f900 into main Sep 24, 2026
5 checks passed
@guardrex
guardrex deleted the oroztocil/validation-docs-nits branch September 24, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants