Problem
Display list of error messages for password as below:
In MVC
We can achieve this by below code:
@Html.Raw(HttpUtility.HtmlDecode(Html.ValidationMessageFor(m => m.Email).ToHtmlString()))
How can we do the same thing in Blazor? Please let me know if more things is required to support the question.
I also need to do this to have a custom validation but that looks like ValidationMessage
and as you said in the comments
How to use the same with the validation message in the Blazor. FYI - validation message in Blazor looks as signUpModel.Email)">
The way to do this is just do the same as ValidationMessage
does and change how it renders
You can just copy the code from the repo and do some changes.
CustomValidationMessage
or anything you want.BuildRenderTree
which is build the html with the validation messages.BuildRenderTree
you can just edit that but I recommend you to remove that method and create a .razor
file that will render the messages.MarkupString(message)
) ..razor
foreach (var message in CurrentEditContext.GetValidationMessages(_fieldIdentifier))
{
@* use message the way you want*@
}