Hi Does anyone know how to create the rules for the jquery form validate plugin when you have a name attribute that is an array?
eg.
<form id="myForm">
<input type="checkbox" name="data[]" id="firstId" value="1" />One <br />
<input type="checkbox" name="data[]" id="secondId" value="2" />One <br />
...
I'm trying to attach a rule to this checkbox using the validate plugin syntax
$('#myform').validate({
rules : {
data: { required: true, minlength: 1
}
}
}
);
Problem is that the 'data' syntax is incorrect. Using data[] or data\[\] is also invalid. I've only gotten it to work with
$('#firstId').rules('add', { required: true, minlength: 1});
Anyone have a suggestion?