MudBlazor icon indicating copy to clipboard operation
MudBlazor copied to clipboard

Form IsTouched not updating until second item changes

Open rslavey opened this issue 2 years ago • 4 comments

Bug type

Component

Component name

MudForm

What happened?

When editing a text field or a check box in a form, the IsTouched value of the form is not updated until you change two things.

Expected behavior

Setting the value of a field in a form should update the IsTouched value of the form on the first edit.

Reproduction link

https://try.mudblazor.com/snippet/maQHYGagByDiJgBz

Reproduction steps

  1. Set value of text box or check box
  2. Observer the button is still disabled
  3. Set value of other field
  4. Observe the button is no longer disabled ...

Relevant log output

No response

Version (bug)

6.1.8

Version (working)

No response

What browsers are you seeing the problem on?

Microsoft Edge

On what operating system are you experiencing the issue?

Windows

Pull Request

  • [ ] I would like to do a Pull Request

Code of Conduct

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

rslavey avatar Feb 06 '23 20:02 rslavey

Updated code to show how it should work:

https://try.mudblazor.com/snippet/cOGRkGYUhzzGNMhw

rslavey avatar Feb 06 '23 20:02 rslavey

You can use ValidationDelay="0", this snippet should do what you want it to: https://try.mudblazor.com/snippet/cOQnOGYiyQZYgNMe

Technically speaking though, your snippet should still produce the same result as my snippet, just with a delay of 300ms, could definitely be considered a bug.

igotinfected avatar Feb 08 '23 11:02 igotinfected

@igotinfected I'm new to MudBlazor, but there may be a connection in that the OnFieldChanged event seems to fire before the IsTouchedChanged event.

Not catching the first change is a bug unless it's defined some way that I don't understand. I only wish I knew enough to fix it.

nhwilly avatar Oct 13 '23 20:10 nhwilly

I would like to make a little up for this bug.

The solution proposed by @igotinfected unfortunately isn't working if the first field edited is a MudSelect.

B0SS avatar Aug 26 '24 09:08 B0SS

This issue has been marked as stale.
If you have any updates or additional information, please comment below.

If no response is received, it will be automatically closed.

github-actions[bot] avatar Aug 17 '25 20:08 github-actions[bot]