我正在尝试添加超过2条规则和消息,但它不起作用..
$("#updateMemberProfileForm").validate({
submitHandler: function(form) {
},rules: {
"member.memberphone" : {
required: true,
phoneUS: true
},
"member.memberfirstname" : {
required: true
},
"member.memberlastname" : {
required: true
},
"member.membermiddlename" : {
required: true
}
},
messages:{
"member.memberphone" : {
required: " * Phone no. required"
},
"member.memberfirstname" : {
required: " * firstname required"
},
"member.memberlastname" : {
required: " * lastname required"
},
"member.membermiddlename" : {
required: "* middlename required"
}
},
errorElement: "span"
});
答案 0 :(得分:1)
这样做
$("#AdditionalDetailsForm").validate({
rules: {
ignore: ":not(:visible)",
Account_Number: {
required: true
},
BaseJurisdiction: {
required: true
}
},
messages: {
Account_Number: {
required: "<br/> Please enter the field"
},
BaseJurisdiction: {
required: "<br/> Please enter the field"
}
}
});
答案 1 :(得分:0)
我认为你错过了一些消息。这是代码..
$("#updateMemberProfileForm").validate({
submitHandler: function(form) {
},rules: {
"member.memberphone" : {
required: true,
phoneUS: true
},
"member.memberfirstname" : {
required: true
},
"member.memberlastname" : {
required: true
},
"member.membermiddlename" : {
required: true
}
},
messages:{
"member.memberphone" : {
required: " * Phone no. required",
phoneUS : "* Enter valid phone no."
},
"member.memberfirstname" : {
required: " * firstname required"
},
"member.memberlastname" : {
required: " * lastname required"
},
"member.membermiddlename" : {
required: "* middlename required"
}
},
errorElement: "span"
});