render FormBuilder Form
| From: | Leo Márquez | Date: | Thu, 02 Sep 2004 11:32:48 +0000 |
| Subject: | render FormBuilder Form | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14382@lists.php.net to get a copy of this message | ||
Hi!
I have a $form object generated with:
$builder=& DB_DataObject_FormBuilder::create($table_name);
$form=& $builder->getForm();
I work with Smarty and if I assign the html code of the form object...
$tpl->assign("MyForm",$form->toHtml());
the form appears correctly when I display the page
$tpl->display('mytpl.tpl');
Now I have to customize the form and I know that the way to do this is
with rendereing (quickform). Then I try :
$renderer =& new HTML_QuickForm_Renderer_Array(true);
// give some elements aditional style informations
$renderer->setElementStyle(array(
'NOM_EMPRESA' => 'Verdana9NormalGrisFluix',
'CIF' => 'Verdana9NormalGrisFluix'
));
$form->accept($renderer);
// assign array with form data
$tpl->assign('form', $renderer->toArray());
$tpl->display("smarty-dynamic.tpl");
Well, the result is that I only view '* Denotes required field'.
What happens with the form? Why don't appear?
If I put {$form} in the template I see 'array'. I'm sure that the
array data of the form can be readed in tpl but I don't know why is
not displayed.
Anyone can help me?
Thanks.
Salutacions,
Leo Márquez
[ Enginyeria del software / Internet ]
[ Calidae - www.calidae.com ]
[ Himalaya Servers - www.himalayaservers.com ]