Trying to validate a form using QuickForm
| From: | Gerard Bowe | Date: | Fri, 08 Jul 2005 17:10:37 +0000 |
| Subject: | Trying to validate a form using QuickForm | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-19917@lists.php.net to get a copy of this message | ||
I have a form set up using QuickForm and everything's fine until I try to access grouped items.
For all individual elements, I have no problem, but when I try and use grouped items I get a warning;
I am doing it like this
.......
$form->addElement('text', 'status', 'Status: ');
$form->addElement('text', 'usregroup', 'User Group: ');
$group[] =& HTML_QuickForm::createElement('text', 'first', 'First Name');
$group[] =& HTML_QuickForm::createElement('text', 'last', 'Last Name');
$form->addGroup($group, 'name', 'Name:', ', ');
.....
echo htmlspecialchars($form->exportValue('name'));
Warning: htmlspecialchars() expects parameter 1 to be string, array given
I guess it's because grouped items are passed as an array, but I'm not sure how to access them so as to further process them.
I want to pass each value to a DB_DataObject, like
$staff = new DataObject_Staff();
$staff->first = htmlspecialchars($form->exportValue('first'));
........
Don't know if this is the right way to do it?
Thanks
Ger