aspnetcore
aspnetcore copied to clipboard
Show asp-for-validation error message in a tooltip instead of span
Problem
ASP.NET Core has beautiful way of handle valiadtion. But the validation style showing in frontend is very old school. The way i have followed:
[Required(ErrorMessage = "UserName is Required")]
[StringLength(10, ErrorMessage = "Must be between 5 and 10 characters", MinimumLength = 5)]
[UserNameVal]
public string UserName { get; set; }
add script for showing message in view
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
Showing error message with span:
<span asp-validation-for="@Model.UserName" class="text-danger"></span>
And this is resulting a primitive old faishon validation message like the screenshot below
Describe the solution you'd like
But i want to use the validation message to show in modern way and show in some other hml tag. And that should resulted like this:
Additional context
Note that i want to use the feature of validating by data annotation in model thats why i am avoiding the messy javascript.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.