Add registration workflow

Update unobtrusive Validation
This commit is contained in:
2020-01-10 14:52:11 -05:00
parent e0464cb77c
commit 8452a9cce0
34 changed files with 235 additions and 898 deletions
+9 -2
View File
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Mvc;
@@ -21,8 +22,7 @@ namespace LeafWeb.WebCms.Utility
: null;
}
private static bool HasError(this HtmlHelper htmlHelper, ModelMetadata modelMetadata, string expression)
public static bool HasError(this HtmlHelper htmlHelper, ModelMetadata modelMetadata, string expression)
{
var modelName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(expression);
var formContext = htmlHelper.ViewContext.FormContext;
@@ -38,5 +38,12 @@ namespace LeafWeb.WebCms.Utility
return modelErrors?.Count > 0;
}
public static bool HasError(this HtmlHelper htmlHelper)
{
var viewDataModelState = htmlHelper.ViewData.ModelState;
return viewDataModelState.ContainsKey(htmlHelper.ViewData.TemplateInfo.HtmlFieldPrefix) &&
viewDataModelState[htmlHelper.ViewData.TemplateInfo.HtmlFieldPrefix].Errors.Any();
}
}
}