Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using an InputNumber backed by a non-nullabe value, deleting the value from the field and changing the rendering breaks the validation message.
@page "/example"
<EditForm EditContext="EditContext">
@if (pageIndex == 0)
{
<InputNumber @bind-Value="Value"/>
<ValidationMessage For="() => Value" />
<button @onclick="()=>++pageIndex">Next</button>
}
else if (pageIndex == 1)
{
<button @onclick="()=>--pageIndex">Back</button>
}
</EditForm>
@code
{
private EditContext EditContext { get; set;; }
public int Value { get; set; }
private int pageIndex;
protected override void OnInitialized()
{
EditContext = new EditContext(Value);
}
}
Expected Behavior
The validation message is still linked to the field and can be removed by inputting a valid value.
Steps To Reproduce
- Delete the value from the InputNumber field and tab out. See the validation message.
- Click Next.
- Click Back.
- See the validation message still exists even though the field has reset to zero.
- Delete the value from the InputNumber field and tab out. See a second validation message. The first validation message can not be removed without reloading the page, while the last message can be removed by setting the field to a number.
- Repeat.
Exceptions (if any)
No response
.NET Version
7.0.302