Re: QF: How to add text to the right of a text field???
| From: | Justin Patrin | Date: | Wed, 13 Jul 2005 17:10:57 +0000 |
| Subject: | Re: QF: How to add text to the right of a text field??? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19978@lists.php.net to get a copy of this message | ||
On 7/13/05, Keith Pettit <keith@setuplinux.com> wrote:
> This is probally a simple question but I'm trying to figure out how to
> add some text to the right of a text field.
>
> $form->addElement('text', 'date_booked', 'Date Booked:');
>
> This form element for example I'd like to add some description to the
> right. I've tried using a group with HTML but that just adds the html
> to the top.
>
> $booked['html'] = &HTML_QuickForm::createElement('html', null,
> 'mm/dd/yyyy'); $booked['date'] =
> &HTML_QuickForm::createElement('text',
> 'date_booked', 'Dateooked:');
> $form->addGroup($booked, 'booked', 'Date Booked:');
>
HTML elements are not a good way to go. They're deprecated and amost
always used wrong (as above :-| ).
If you're using the default renderer, just change the element's template.
$renderer =& HTML_QuickForm::defaultRenderer();
$renderer->setElementTemplate(str_replace('{element'}, '{element}
mm/dd/yyyy', $renderer->_elementTemplate), 'date_booked');
--
Justin Patrin