Quickform group error
| From: | rav k | Date: | Fri, 08 Dec 2006 12:43:52 +0000 |
| Subject: | Quickform group error | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-26023@lists.php.net to get a copy of this message | ||
Hi
This is what I'm doin to dynamically add the skills as checkboxes:
/* ADD THE SKILLS */
$res =& $mdb2->query('SELECT * FROM Skills');
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
$skills[] = &HTML_QuickForm::createElement('advcheckbox', $row['skillid'], null,'<b>'.$row['skillname'].'</b>'.' : '.$row['description']);
}
And I am adding them this way:
$form->addGroup($skills, 'skills', 'Your skills:', '<br />');
The problem is I get the following error when attempting to validate:
Fatal error: Call to a member function on a non-object in /home/user/public_html/iim/pear/PEAR/HTML/QuickForm/group.php on line 391
I have attempted to fix by removing the name field ie:
$form->addGroup($skills, null, 'Your skills:', '<br />');
This works fine but the problem is that I need to be able to check that at least one skill is selected and without the name this won't work:
$form->addGroupRule('skills', 'You need at least 1 skill', 'required', null, 1);
Can anyone please offer a solution to this??
Thanks
www.bitesoftware.com - software for a better lifestyle
_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! http://www.msn.co.uk/newsletters