when use yii activeform ajax validataion, the auto generated js code is use inputID for validation, but when I use radiobuttonlist or checkboxlist, the inputID will still be the attribute, but the input’s ID will be ordered form 0 to n, so the jquery can not find the element, the ajax validation will not be triggered.
I noticed that the jquery validation plugin use element’s name for validation, not the ID, I think it is better and logical.
<input value="休闲" id="line_subject_0" type="checkbox" name="line[subject][]" /> <label for="line_subject_0">休闲</label> <input value="滑雪" id="line_subject_1" type="checkbox" name="line[subject][]" /> <label for="line_subject_1">滑雪</label> <input value="避暑" id="line_subject_2" type="checkbox" name="line[subject][]" /> <label for="line_subject_2">避暑</label> <input value="文化游" id="line_subject_3" type="checkbox" name="line[subject][]" />
the auto gen js is :
$('#line-form').yiiactiveform({'attributes':[{'inputID':'line_subject','errorID':'line_subject_em_'},
the ID ‘line_subject’ is not exists, so the validation will not be triggered.