RE: [PEAR] QuickForm Renderer Question
| From: | Alex Housley | Date: | Mon, 01 Mar 2004 16:51:07 +0000 |
| Subject: | RE: [PEAR] QuickForm Renderer Question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11041@lists.php.net to get a copy of this message | ||
Sorry... just realised... replace {header_2} with {label_2}...
Thanks
Alex
-----Original Message-----
From: Alex Housley [mailto:alexhousley@dsl.pipex.com]
Sent: 01 March 2004 16:49
To: pear-general@lists.php.net
Subject: RE: [PEAR] QuickForm Renderer Question
Hi Guys
Just to let you know, I have figured a way around this...
See updated code:
$form->addElement('text', 'header', array('Company Details',
'short description'));
$header_template =
'<tr>
<td style=\"white-space:nowrap;background:#F5E004;color:#000000;\"
align=\"left\" colspan=\"2\">
<b>{label} <!-- BEGIN label_2 --><br /><span style="font-size:
80%;">{header_2}</span><!-- END label_2 --></b>
</td>
</tr>';
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate($header_template, 'header');
$form->accept($renderer);
$form->display();
Seems a little hacky because I'm not using the setHeaderTemplate for what is
clearly a header, and now either have to rename all of the headers to
'header' or use the setElementTemplate for each method - which may present
problems in the future..
Any other ideas of how this could be achieved?
Thanks
Alex
-----Original Message-----
From: Alex Housley [mailto:alexhousley@dsl.pipex.com]
Sent: 01 March 2004 14:36
To: pear-general@lists.php.net
Subject: [PEAR] QuickForm Renderer Question
Hi Guys
I am creating a form with HTML_Quickform 3.2.1 and customising the default
renderer to get the look and feel I want.
How do I pass an array of information to a header tag for my custom template
to render the header title and a description? Here is a sample of the
relevant code, which displays Array {header_2} when executed.
$form->addElement('header', 'header_company', array('Company
Details',
'short description'));
$header_template =
'<tr>
<td style=\"white-space:nowrap;background:#F5E004;color:#000000;\"
align=\"left\" colspan=\"2\">
<b>{header} <!-- BEGIN header_2 --><br /><span style="font-size:
80%;">{header_2}</span><!-- END header_2 --></b>
</td>
</tr>';
$renderer =& $form->defaultRenderer();
$renderer->setHeaderTemplate($header_template);
$form->accept($renderer);
$form->display();
What am I doing wrong?
Many Thanks
Alex
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php