无法通过require_from_group方法传递验证 - jQuery Validator

时间:2015-03-05 18:19:30

标签: javascript jquery validation rules required

我导入的脚本

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/additional-methods.min.js"></script>

我的表单

    <input name="tel"    type="text"  class="form-control contact" >
    <input name="mobile" type="text"  class="form-control contact" >
    <input name="email"  type="email" class="form-control contact" >

我的验证规则

    $('#new-contact-form').validate({

        rules: {
            name:   { required: true },
            title:  { required: true }, 
            mobile: { require_from_group: [1, '.contact'] },
            tel:    { require_from_group: [1, '.contact'] },
            email:  { require_from_group: [1, '.contact'] },
        }   

    });

当验证器验证表单输入时,即使我填写了一个或多个输入,我也会收到每个输入的错误消息:Please fill at least 1 of these fields。我错过了什么吗?

0 个答案:

没有答案