我有一个包含NewPassword字段的chang密码的简单视图模式,如下所示:
[Display(Name = "NewPassword", ResourceType = typeof(Resources.Resources))]
[RegularExpression(@"(?=^[^\s]{8,16}$)((?=.*?\d)(?=.*?[A-Z])(?=.*?[a-z])|(?=.*?\d)(?=.*?[^\w\d\s])(?=.*?[a-z])|(?=.*?[^\w\d\s])(?=.*?[A-Z])(?=.*?[a-z])|(?=.*?\d)(?=.*?[A-Z])(?=.*?[^\w\d\s]))^.*", ErrorMessageResourceName = "NewPasswordFormat", ErrorMessageResourceType = typeof(Resources.Resources))]
public string NewPassword { get; set; }
并且看起来像这样
@Html.PasswordFor(m => m.NewPassword, new { @class = "form-control", @placeholder = Resources.NewPassword })
@Html.ValidationMessageFor(m => m.NewPassword)
用户输入错误值后,出现验证消息, 但在用户修复值并丢失输入字段后,验证消息未清除 怎么有人知道如何纠正这个?