I'm trying to use Joomla's (version 3.4.3) built in form validator: JHTML::_('behavior.formvalidator');
I'm trying to apply it for a dynamically generated form. It works fine for dropdown menus and textfields. But when (lets say) I have a group of 4 checkboxes and I want the user to select at least 1 of the 4 then I ran into a problem... The site asks the user to select ALL 4 checkboxes. Here is the generated HTML code:
<label title="Checked out?" class="hasTooltip required" for="jform_checked-out_cbv_qwq4-473" id="checked-out_cbv_qwq4-473-lbl">Checked out? <span class="star">*</span></label>
<input type="checkbox" name="checked-out_cbv_qwq4-473[]" id="checked-out_cbv_qwq4-473" value="Yes" class="required" aria-required="true" required="required"> Yes
<input type="checkbox" name="checked-out_cbv_qwq4-473[]" id="checked-out_cbv_qwq4-473" value="No" class="required" aria-required="true" required="required"> No
<input type="checkbox" name="checked-out_cbv_qwq4-473[]" id="checked-out_cbv_qwq4-473" value="maybe" class="required" aria-required="true" required="required"> maybe
<input type="checkbox" name="checked-out_cbv_qwq4-473[]" id="checked-out_cbv_qwq4-473" value="of course not" class="required" aria-required="true" required="required"> of course not
When I try to submit the form I get these error messages:
Invalid field: Checked out?
Invalid field: Checked out?
Invalid field: Checked out?
Invalid field: Checked out?
What am I doing wrong here?
Aucun commentaire:
Enregistrer un commentaire