Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.16

Bug #184 Checkbox groups and JS validation incorrect
Submitted: 2003-11-02 06:39 UTC
From: graeme Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: 4.3.3 OS: Linux (Redhat 9)
Roadmaps: (Not assigned)    

 [2003-11-02 06:39 UTC] graeme
Description: ------------ Hi. I've been poking around in Quickforms trying to get client-side validation working for a group of checkboxes. From the example code: $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'A', null, 'A'); $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'B', null, 'B'); $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'C', null, 'C'); $checkbox[] = &HTML_QuickForm::createElement('checkbox', 'D', null, 'D'); $form->addGroup($checkbox, 'destination', 'Destination:', array(' ', '<br />')); $form->addGroupRule('destination', 'Please check at least two boxes','required', null, 2); If I make add 'client' to the addGroupRule() method, QuickForms outputs Javascript on the page as expected var field = frm.elements['destination']; var regex = /(\s|\S)/; if (!regex.test(value) && !errFlag['destination']) { errFlag['destination'] = true; _qfMsg = _qfMsg + '\n - Please check at least two boxes'; } However. this is not correct code for checkboxes. Looking at QuickForm.php is appears that because I've created a group, this is the javascript that is displayed as opposed to the javascript for a checkbox. This may be further compounded by the way QF renders checkbox groups.


 [2003-11-03 16:08 UTC] avb
This is fixed in CVS. Please check the current CVS version and reopen this bug if something does not work properly.