gpt4 book ai didi

JQuery 验证插件允许发布无效数据

转载 作者:行者123 更新时间:2023-12-01 06:08:53 26 4
gpt4 key购买 nike

我的表单有以下验证规则:

function ValidadeRegistration() {
$('#RegistrationForm').validate({
rules: {
"auth.UserName": {
required : true,
email: true
},
"auth.Password": {
required : true,
minlenght : 5
},
PasswordConfirmation: {
required: true,
minlength: 5,
equalTo: "#password"
}
},
messages: {
"auth.UserName": {
email: 'Por favor digite um e-mail válido.',
required: 'Campo e-mail obrigatório.'
},
"auth.Password": {
required: 'Campo senha obrigatório.',
minlength: 'A sua senha deve conter ao menos 5 caract$eacute;res.'
},
"PasswordConfirmation": {
required: 'Confirmação da senha é obrigatória.',
equalTo : 'A senha não bate.'
}
}
});

}

错误消息显示正确,并且当我在任何字段中包含无效数据时,插件会阻止帖子,但是允许帖子所需的只是“auth.Password”字段中存在数据。如果我在此字段中写了任何内容(甚至不必达到指定的长度),则插​​件会忽略所有其他错误和帖子。

我做错了什么?

最佳答案

minlength 拼写错误:

当前:

    "auth.Password": {
required : true,
minlenght : 5
},

更正:

    "auth.Password": {
required : true,
minlength : 5
},

关于JQuery 验证插件允许发布无效数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2268090/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com