我有一组在我的HTML复选框看起来像这样的,笨表单验证和数组作为字段名
div class="grid_7">
<fieldset class="age shadow_50">
<label class="legend">Age Group</label>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="child" />
<label>Child</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="30's" />
<label>30s</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="60's" />
<label>60's</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="teen" />
<label>Teen</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="40's" />
<label>40's</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="70's" />
<label>70's</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="20's" />
<label>20's</label>
</div>
<div class="formRow checkbox">
<input id="" type="checkbox" name="age[]" value="50's" />
<label>50's</label>
</div>
</fieldset>
</div>
我已在我的控制器验证规则(在我心中)可确保复选框被选中,
$this->form_validation->set_rules('age[]', 'age group', 'required|trim');
当测试这个,但是我得到一个错误信息与名年龄过复选框[]我只是想检查,年龄[]是不是空的。
我该如何做到这一点?