dotnet / dotnet/aspnetcore

Show asp-for-validation error message in a tooltip instead of span

Open
#24,443 1 comment 2 reactions 0 assignees View on GitHub
affected-very-few area-mvc enhancement feature-mvc-razor-views feature-tag-helpers severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### 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 {

}
```
Showing error message with 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.