我想显示我在Aurelia验证中应用的所有错误消息。例如,如果用户单击“密码”输入框,则所有相关的错误消息应按用户所要求的条件逐步突出显示/显示并隐藏/删除错误。我给你看我的模特。
"newpassword":{
"name": "newpassword",
"value": "",
"rules": [
{
"type": "isValidRegExp",
"args": [/(?=.*[a-z])/],
"msg" : "Password must contain at least 1 lowercase alphabetical character."
},
{
"type": "isValidRegExp",
"args": [/(?=.*[A-Z])/],
"msg" : "Password must contain at least 1 uppercase alphabetical character."
},
{
"type": "isValidRegExp",
"args": [/(?=.*[0-9])/],
"msg" : "Password must contain at least 1 numeric character."
},
{
"type": "isValidRegExp",
"args": [/(?=.[!@#\$%\^&])/],
"msg" : "Password must contain at least 1 special character."
},
如果用户进入“密码”字段,则应向用户显示模型中显示的4条错误消息
1- Password must contain at least 1 lowercase alphabetical character.
2- Password must contain at least 1 uppercase alphabetical character.
3- Password must contain at least 1 numeric character.
4- Password must contain at least 1 special character.
然后,如果用户满足选项1,则选项1错误应为隐藏/删除等。
当前同时显示1条错误消息。