JQuery validate and checkboxes
Hello,
I recently discovered the the jquery validate plugin and I like very much. But I can't seem to use it for check boxes and radio buttons.
Has anyone used it for check boxes and radio button?
For example I have the following in my form:
-
<p>
<input type="checkbox" name="req_organization[]" id="req_savings_and_loan" value="Savings and Loan"
<% if(inStr(Request.Form("req_organization[]"),"Savings and Loan")) then response.write("checked=""checked""") %> />
<label for="req_savings_and_loan">Savings & Loan</label>
<input type="checkbox" name="req_organization[]" id="req_appraiser" value="Appraiser"
<% if(inStr(Request.Form("req_organization[]"),"Appraiser")) then response.write("checked=""checked""") %> />
<label for="req_appraiser">Appraiser</label>
</p>
Now if I try something like the following it simply breaks the javascript.
Does anyone have any solution for this?
-
$("#contactForm").validate({
//set the rules for the field names
rules: {
req_savings_and_loan: {
required: true,
minlength: 2
},
},
//set messages to appear inline
messages: {
req_appraiser: "Please select one",
}
});
});
Notice that I am using the id. Is that the problem? This method works fine with text boxes but not check boxes. Why?
Many thanks in advance for your help.