|
Hello all, Bellow is a portion of code that I need help with:
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '1', null, 'Hearing Impaired');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '2', null, 'Visual Impaired');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '3', null, 'Mental Health');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '4', null, 'Assisted Living');
$chkboxtype[] = &HTML_QuickForm::createElement('checkbox', '5', null, 'Independent Living');
$form->addGroup($chkboxtype, 'chkboxtype', 'Type:');
$rule['0'][] = array('Please select at least one type!', 'required');
$form->addGroupRule('chkboxtype', $rule);
The addGroupRule above works perfectly but, only half the battle with what I'm trying to do. I do not want to validate each individual checkbox element. How do I check and make sure one of the check boxes are selected and if not output "Please select at least one type!"
-Thanks,
Rich
|