-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed
Labels
Milestone
Description
Using Blazor with .NET Core 3.1 Preview.
Have a date picker inside of an EditForm model with a validation message:
<EditForm Model="@request" OnValidSubmit="@SubmitRequest">
<ValidationSummary></ValidationSummary>
<DataAnnotationsValidator />
<div class="field">
<MatDatePicker Label="Need Date" @bind-Value="request.RequestedByDate"></MatDatePicker>
<ValidationMessage For="@(() => request.RequestedByDate)" />
</div>
<MatButton Raised="true" Type="submit">Save</MatButton>
</EditForm>
This is a custom validation I created to make sure a date in the past is not chosen. The error message displays if incorrect date is chosen. However, if the form if the submit button is clicked, the form does not submit (correct), but the validationmessage for the field disappears.
I added the <ValidationSummary>
tag up top to test. The error message stays present there even after button clicked. Just not in the Validation Message.