Closed captainsafia closed 4 years ago
We now support setting a DisplayName attribute on InputNumber, InputDate, and InputSelect components. So for example, I can have a form that looks like this.
DisplayName
@page "/form" <EditForm Model="@this" OnValidSubmit="@HandleValidSubmit"> <div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text" id="birth-date">Date of Birth</span> </div> <InputDate Class="form-control" Id="DateOfBirth" @bind-Value="@BirthDate" DisplayName="birthday"/> <div class="invalid-feedback d-block"> <ValidationMessage For="@(() => BirthDate)" /> </div> </div> </EditForm> @code { public DateTime BirthDate { get; set; } public void HandleValidSubmit() { Console.WriteLine("foo"); } }
If the date field is invalid, then the validation message will read:
The birthday must be a date.
Wheras previously, it would show this.
The BirthDate must be a date.
We probably want to add this under the "Validation Support" heading.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Why does this not apply to <InputText...> also?
<InputText...>
Moved to https://github.com/dotnet/AspNetCore.Docs/issues/22515.
@mxmissile ... Best to open a new issue. We don't work closed issues/PRs.
We now support setting a
DisplayName
attribute on InputNumber, InputDate, and InputSelect components. So for example, I can have a form that looks like this.If the date field is invalid, then the validation message will read:
Wheras previously, it would show this.
We probably want to add this under the "Validation Support" heading.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.