这是我的具有属性 OldPassword 的模型
[Required]
[StringLength(16, ErrorMessage = "The Old Password must be at least 8 characters long.", MinimumLength = 8)]
[RegularExpression("^(?=.*[a-z])(?=.*[A-Z]).+$", ErrorMessage = "Old Password is Not a valid Password")]
[Display(Name = "Old Password")]
public string OldPassword { get; set; }
这是渲染的输出
<input class="inputsmall defaultFocus input-validation-error" data-val="true"
data-val-length="The Old Password must be at least 8 characters long."
data-val-length-max="16" data-val-length-min="8"
data-val-regex="Old Password is Not a valid Password"
data-val-regex-pattern="^(?=.*[a-z])(?=.*[A-Z]).+$"
data-val-required="The Old Password field is required." id="OldPassword" maxlength="16" name="OldPassword" style="width: 295px;" type="password">
当前的验证触发顺序是
- 必需的
- 正则表达式
- 长度
我想将订单更改为
- 必需的
- 长度
- 正则表达式
我用谷歌搜索了很多,找不到任何直接的解决方案。请帮我解决一下这个。