MudBlazor/MudBlazor

[MudForm] Errors property does not cover child forms.

已关闭

#11,193 创建于 2025年4月14日

 (1 条评论) (0 个反应) (0 位负责人)C# (1,631 个派生)batch import
buggood first issue

仓库指标

星标
 (10,394 个星标)
PR 合并指标
 (平均合并 6天 6小时) (30 天内合并 108 个 PR)

描述

Things to check

  • I have searched the existing issues for this bug
  • To rule out a caching problem I made sure the bug also happens in an incognito tab

Bug type

Component

Component name

MudForm

What happened?

The Errors property does not appear to include the errors from child forms. While properties like Valid do indeed reflect child form validity.

I cannot share the code but referencing the source code makes the behavior pretty obvious: https://github.com/MudBlazor/MudBlazor/blob/df922eb52315993bdb47b71d98a36a2277be06b9/src/MudBlazor/Components/Form/MudForm.razor.cs#L224-L234

L227 only includes the current form's controls. to add to the _errors property.

I suggest we add a second line right after the loop that takes the Errors properties from each ChildForm and appends that to the _errors array too.

I'd like to hear your take on this.

Expected behavior

All errors from all childforms are include in the Errors array.

Reproduction link

https://try.mudblazor.com/no-time-right-now

Reproduction steps

  1. nest 2 forms
  2. add fluent validators
  3. create an validation error in the child form
  4. observe no errors in the parent form Errors property ...

Relevant log output

Version (bug)

still on main

Version (working)

No response

What browsers are you seeing the problem on?

Chrome

On which operating systems are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct

贡献者指南