I have a simple web application with create page using form with validations.
.cs code:
public class OneTask
{
public int Id { get; set; }
[Required] public string Title { get; set; }
[Required][MinLength(10)]
public string Description { get; set; }
[Required, Range(1,5)] public int Priority { get; set; }
}
.cshtml code:
<div class="container" style="width:50%">
<div asp-validation-summary="All"></div>
<form asp-page="CreateTask" class="" method="post">
<div class="form-group">
<label asp-for="NewTask.Title">Title</label>
<input asp-for="NewTask.Title" class="form-control" />
// rest of form here...
validation scripts:
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
Instead of showing error validations in red it shows it in black.
---------------------------------------------|
---------------------------------------------|
Can you help ?
Just add class="text-danger"
to change the text color
<div class="text-danger" asp-validation-summary="All"></div>