Skip to content

MudFormComponent: Make ErrorText property two-way bindable#12119

Merged
ScarletKuro merged 5 commits intoMudBlazor:devfrom
soridev:fix/ErrorTextBinding
Nov 18, 2025
Merged

MudFormComponent: Make ErrorText property two-way bindable#12119
ScarletKuro merged 5 commits intoMudBlazor:devfrom
soridev:fix/ErrorTextBinding

Conversation

@soridev
Copy link
Contributor

@soridev soridev commented Nov 17, 2025

Checklist:

  • I've read the contribution guidelines
  • My code follows the style of this project
  • I've added or updated relevant unit tests

Fixes #12106

This PR changes the property ErrorText in the component MudFormComponent. The EventCallback ErrorTextChanged is added and the property is now using ParameterState as described in the contribution guidelines. Since the ErrorText property is used in alot of UnitTests i had to adjust all of the usages in the tests to use .GetState().

The ErrorText property is also used directly inside MudPicker, MudFileUpload and MudDateRangePicker so those components had to be adjusted in the usage of the property.

The changes in the implementation of the property was done by @ScarletKuro , thanks for helping me with this issue.
This is my first contribution to this repository so i would appreciate a thoroughly check of the changes so i dont break something by accident.

@mudbot mudbot bot added breaking change This change will require consumer code updates enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library labels Nov 17, 2025
@ScarletKuro
Copy link
Member

Run dotnet format pls.
Also, it would be nice if you could add one test for #12106
that two way binding is working, you can take the the inspiration from the ticket trymud itself https://try.mudblazor.com/snippet/GuczFvvmfxXemRgK just need to clean it up.

@mudbot mudbot bot added needs: changes A maintainer has asked for further modifications to be made to this pull request needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request labels Nov 17, 2025
@soridev
Copy link
Contributor Author

soridev commented Nov 18, 2025

I added a testcomponent similar to the trymud from the original issue and added a new unittest to check the intended behavior.

@mudbot mudbot bot changed the title MudFormComponent: Make ErrorText property two-way bindable (#12106) MudFormComponent: Make ErrorText property two-way bindable Nov 18, 2025
@mudbot mudbot bot removed needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request needs: changes A maintainer has asked for further modifications to be made to this pull request labels Nov 18, 2025
@ScarletKuro
Copy link
Member

Yeah, looks great.
@danielchalmers I guess I’ll merge this into v8. I don’t think it introduces any breaking changes. Some bUnit tests might fail if someone copy-pasted ours, but we’ve never treated test changes as breaking, and the overall behavior hasn’t really changed.

@mudbot mudbot bot removed the breaking change This change will require consumer code updates label Nov 18, 2025
@ScarletKuro ScarletKuro merged commit 0792026 into MudBlazor:dev Nov 18, 2025
4 checks passed
@ScarletKuro
Copy link
Member

ScarletKuro commented Nov 18, 2025

Thanks, one step further to make validation better. Technically, the same should be done for Error, ValidationErrors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudTextField - Error Binding Not Working

2 participants