-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsquestion
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When i submit the form, if I don't change the value of the select, I have no validation error.
If I change value and go back to the empty choice, the error is shown.
public class MyModel
{
[Required]
public int MyProperty { get; set; }
}
<EditForm Model="model" OnValidSubmit="HandleValidSubmit">
<DataAnnotationsValidator />
<ValidationSummary />
<InputSelect @bind-Value="model.MyProperty">
<option></option>
<option value="1">1</option>
<option value="2">2</option>
</InputSelect>
<button type="submit">Save</button>
</EditForm>
@code
{
MyModel model = new();
void HandleValidSubmit()
{
}
}
This is when you click insert without changing option

This is when you click insert changing option and going back to the empty choice

Expected Behavior
The validation should trigger also when I don't modify the choice
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
7
Anything else?
No response
Metadata
Metadata
Assignees
Labels
✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Resolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Componentsquestion