DB_DataObject_FormBuilder: Group Handling
| From: | Sönke Ruempler | Date: | Mon, 06 Dec 2004 10:50:13 +0000 |
| Subject: | DB_DataObject_FormBuilder: Group Handling | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-16043@lists.php.net to get a copy of this message | ||
Hi,
I'm trying to add a QuickForm Group for a File Upload Field in Formbuilder.
The Field is represented as varchar field in the table and should save the
file extension.
I have an own DataObject Class where I want to put standard methods for
forms, and also for file upload fields. For each file upload field I want to
generate a group of elements with the field on it's own, a link to show the
uploaded file (if something is uploaded) and a checkbox to delete a existing
upload file.
While experimenting with FormBuilder I noticed that I can
1) Use preDefElements with arrays to create the group like
public function preGenerateForm($fb) {
if (isset($fb->_do->fb_fileUploadFields)) {
foreach ($fb->_do->fb_fileUploadFields as
$uploadFieldName => $uploadField) {
$fb->_do->fb_preDefElements[$uploadFieldName] = array(
HTML_QuickForm::createElement('file', $uploadFieldName),
HTML_QuickForm::createElement('text', 'blah')
);
Now a Group is created, but I can't edit the group seperator, and the field
names in the form are not like group[element_name]. fb_fileUploadFields is
my own variable that indicates which fields are upload fields.
2. Use preDefGroups
I do not understand, why the array is name => group and not, group_name =>
array of elements. This would imho make more sence.
Thx for your help!