Does anyone know how to create rules for a jquery form validate if 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 am trying to attach a rule to this checkbox using validate plugin syntax
$('#myform').validate({ rules : { data: { required: true, minlength: 1 } } } );
The problem is that the syntax for "data" is incorrect. Use of data [] or data \ [\] is also not valid. I just started working with
$('#firstId').rules('add', { required: true, minlength: 1});
Anyone have a suggestion?
jquery plugins validation forms
bunwich
source share