Add registration workflow
Update unobtrusive Validation
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user