1

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"
        });
4

2 に答える 2

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"
            }
        }
    });
于 2012-05-09T06:10:59.360 に答える
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"
        });
于 2012-05-09T06:22:56.707 に答える