Reputation: 1929
I'm trying to customize the way the client-side validation is displayed on my form.
I don't want to use the asp-validation-for
tags so they don't display with the control. I'd rather show these in the ValidationSummary
control with the other errors or some other centralized place.
Is there a way to show the client-side model.field errors anywhere other than using a asp-validation-for
tag?
Upvotes: 0
Views: 617
Reputation: 11342
Use validation summary tag helper with attribute asp-validation-summary="All"
<form asp-controller="Demo" asp-action="RegisterValidation" method="post">
<div asp-validation-summary="All"></div>
</form>
Ιt's important that the validation summary tag helper is placed inside the <form>
tag!
Upvotes: 2