Re: [QuickForm] Setting element template to a hidden
| From: | Justin Patrin | Date: | Sun, 20 Nov 2005 05:09:34 +0000 |
| Subject: | Re: [QuickForm] Setting element template to a hidden | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22016@lists.php.net to get a copy of this message | ||
On 11/19/05, Mark Steudel <mark@netriver.net> wrote:
> I was wondering if setting the template for hidden fields is different than
> other element types?
>
> $renderer =& $form->defaultRenderer();
> $hidden_element='
> <tr>
> <td align="left" valign="top" colspan="2">
> {element}
> </td>
> </tr>
> ';
>
> -- This doesn't work:
> $form->addElement('hidden', 'id', $objData->id);
> $renderer->setElementTemplate( $hidden_element, 'id');
>
> -- But this does work:
> $form->addElement('static', 'editor', 'Editor:',
> "$output", array( 'size' =>
> '500') );
> $renderer->setElementTemplate( $hidden_element, 'editor');
>
Hiddens are different than normal elements. Hiddens are not displayed
and are not meant to be displayed. Adding a table row for them is
nonsensical since nothing will be shown in them. QF usually outputs
hiddens at the top of the form before the table and not where you
added them in the code.
--
Justin Patrin