Re: render FormBuilder Form

From: Date: Thu, 02 Sep 2004 15:47:25 +0000
Subject: Re: render FormBuilder Form
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14383@lists.php.net to get a copy of this message
On Thu, 2 Sep 2004 13:32:48 +0200, Leo Márquez <leo@calidae.net> wrote: > Hi! > > I have a $form object generated with: > > $builder=& DB_DataObject_FormBuilder::create($table_name); $table_name is a DataObject, right? > $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. You need to look at the examples for that renderer. I believe you need to do a {foreach from=$form item="element"}, but I don't know the specifics. > > Anyone can help me? > > Thanks. > > Salutacions, > > Leo Márquez > [ Enginyeria del software / Internet ] > [ Calidae - www.calidae.com ] > [ Himalaya Servers - www.himalayaservers.com ] > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > !DSPAM:4136a1e4221531426318096! > > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.pear.general (#14383) next »