我有一个带有一组复选框的表单字段,并且必须选择多个复选框中的至少一个才能提交表单。
我如何使用 YUI3 规则来实现这一点?
非常感谢,
rules: {
fname: {
required: true,
},
email: {
required: true,
email: true
},
tel: {
required: true,
digits: true,
},
dob: {
date: true,
},
},
fieldContainer: '.form__item',
containerErrorClass: 'form__item--error',
HTML:
<fieldset class="form__item form__item--group">
<legend class="form__item__label">
A group of checkboxes
<div class="form__item__label__instructions">
Select one of them.
</div>
</legend>
<input name='errorMessageAnchor' hidden/>
<label class="form__item__label" for="cb1">
<input id="cb1" name="cbName" type="checkbox" class="checkbox" /> One
</label>
<label class="form__item__label" for="cb2">
<input id="cb2" name="cbName" type="checkbox" class="checkbox" /> Two
</label>
<label class="form__item__label" for="cb3">
<input id="cb3" name="cbName" type="checkbox" class="checkbox" /> Three
</label>
<label class="form__item__label" for="cb4">
<input id="cb4" name="cbName" type="checkbox" class="checkbox" /> Four
</label>
</fieldset>