Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery验证器-所有错误的公共消息_Jquery_Jquery Validate - Fatal编程技术网

Jquery验证器-所有错误的公共消息

Jquery验证器-所有错误的公共消息,jquery,jquery-validate,Jquery,Jquery Validate,我正在对我的表单使用以下验证规则。我需要为所有验证显示一条常见错误消息。我已将控件分组,但无法传递消息 $(function() { jQuery.validator.addMethod("lettersonly", function(value, element) { return this.optional(element) || /^[a-z]+$/i.test(value); }, "Letters only please"); $(".form").validate({ erro

我正在对我的表单使用以下验证规则。我需要为所有验证显示一条常见错误消息。我已将控件分组,但无法传递消息

$(function() {

jQuery.validator.addMethod("lettersonly", function(value, element) {
return this.optional(element) || /^[a-z]+$/i.test(value);
}, "Letters only please");

$(".form").validate({

errorLabelContainer: "#errorMessages",
groups: {
    username: "name email lName zip"
},
rules: {
    name:{
        required: true,
        lettersonly: true
    },
    email: {
        required: true,
        email: true
    },
    lName: "required",
    zip: "required"
},      
messages: {
    username:"Sorry friend, your vote was not processed because you forgot to enter the required information. Enter it now."
}
});
});
function(){
    bValid = bValid && Function1toValidate($('#txtTitle'));
    bValid = bValid && Function2toValidate($('#txtEmail'));

    if (bValid)
    {
        proceed with the procedure
    }
    else
    {
        your error message
    }
}

//those validate functions code it here
Function1toValidate()
{}
Function2toValidate()
{}