Re: QF: smarty renderer and element names with brackets []
| From: | Thomas Schulz | Date: | Wed, 19 Nov 2003 14:05:13 +0000 |
| Subject: | Re: QF: smarty renderer and element names with brackets [] | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9021@lists.php.net to get a copy of this message | ||
Jeroen Houben wrote in php.pear.general:
> I'm migrating some QF code from version 2 to 3 using the Smarty
> renderer. Mostly works well except for some more advanced things.
> Here's what I want to do:
>
> foreach ($institution as $instID => $instName) {
> $radio[] = &HTML_QuickForm::createElement('radio', null, null, 'Yes',
> 'yes');
> $radio[] = &HTML_QuickForm::createElement('radio', null, null, 'No',
> 'no'); $form->addGroup($radio, "conn_allowed[$instID]" ,null,
> ' ');
> $form->addElement('text', "conn_marketshare[$instID]",null,
> array("size"=>3, "maxlength"=>3));
> }
The better way the handle such dynamicly created forms is to use the
(dynamic) Array-Renderer.
> The Smarty renderer doesn't handle this properly, it seems the $instID
> is used as the key. I saw this problem being discussed here
>
> http://marc.theaimsgroup.com/?l=pear-general&m=106805748517988&w=2
> and
> here http://pear.php.net/bugs/bug.php?id=253 so I know it is
> being
> addressed, but is there any quick solution for now, like using nested
> groups or something?
You can try to use the patch from http://pear.php.net/bugs/bug.php?id=202
or the Array-Render (SmartyDymamic-example.php).
ThS.
--
http://4bconsult.de