views:

18

answers:

0
 $("#commentForm").validate({
            rules: {
                insurance1$ucBuildingInsurance$txtOtherReasonDescription:
                {
                    depends: function(element) {
                        return $("#bc [id$=_dpOwnInsurance]").value == "1";
                    }
                    //insurance1$ucBuildingInsurance$txtOtherReasonDescription: "required"
                }
            },
            messages: {
                insurance1$ucBuildingInsurance$txtOtherReasonDescription: "Please enter an other reason........."
            }
        })

I want to validate the txtOtherReasonDecription only if the dpOwnInsurance value is "1". My code is pasted a above and it seems firing for all scenarios of dpOwnInsurance which are values 1,2,3.Am I using the syntax properly?