Skip to content

Commit

Permalink
Custom error messages with validation message tag helper aspnet#8035
Browse files Browse the repository at this point in the history
  • Loading branch information
kishan.anem committed Jul 15, 2018
1 parent 54baa7d commit b206e5b
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -71,11 +71,13 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
};
}

var childContent = await output.GetChildContentAsync();

var tagBuilder = Generator.GenerateValidationMessage(
ViewContext,
For.ModelExplorer,
For.Name,
message: null,
message: childContent.IsEmptyOrWhiteSpace ? null : childContent.GetContent(),
tag: null,
htmlAttributes: htmlAttributes);

Expand All @@ -89,7 +91,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
// We check for whitespace to detect scenarios such as:
// <span validation-for="Name">
// </span>
var childContent = await output.GetChildContentAsync();

if (childContent.IsEmptyOrWhiteSpace)
{
// Provide default message text (if any) since there was nothing useful in the Razor source.
Expand Down

0 comments on commit b206e5b

Please sign in to comment.