Home > Archive > PHP Pear > April 2006 > Re: [PEAR] adding class to td in HTML_Quickform
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: [PEAR] adding class to td in HTML_Quickform
|
|
| Justin Patrin 2006-04-27, 7:01 pm |
| On 4/27/06, Michael Larocque <mlarocque@prolumina.com> wrote:
> Hi all,
>
> I'm relatively new to PEAR. My first usage involves HTML_Quickform.
> I'm using it to create a very simple form.
>
> The following php snippet:
>
> parent::HTML_QuickForm('formContact', 'post');
> $this->addElement('text', 'name', 'Name');
> $this->addRule('name', 'A name is required', 'required');
> ...
>
> produces the following html snippet:
>
> <tr>
> <td align=3D"right" valign=3D"top"><span style=3D"color: =
#ff0000">*</
> span><b>Name</b></td>
> <td valign=3D"top" align=3D"left"><input name=3D"name" ty=
pe=3D"text" /></td>
> </tr>
>
> What I'd like to do is to add a 'class=3D"foo"' to the first td (i.e.
> the label) so that I can style it, and optionally remove the 'align'
> and 'valign' bits. i.e.:
>
> <tr>
> <td class=3D"foo"><span style=3D"color: #ff0000">*</span>=
<b>Name</b></td>
> <td valign=3D"top" align=3D"left"><input name=3D"name" ty=
pe=3D"text" /></td>
> </tr>
>
> Is there a simple way of doing this? Any help greatly appreciated.
>
Before you output the form:
$r =3D& HTML_QuickForm::defaultRenderer();
$r->setElementTemplate('...', 'name');
Where '...' is the template you want to use. Look in the
HTML/QuickForm/Renderer/Default.php for the default element template.
--
Justin Patrin
| |
| Michael Larocque 2006-04-27, 7:01 pm |
|
On 27-Apr-06, at 11:19, Justin Patrin wrote:
> On 4/27/06, Michael Larocque <mlarocque@prolumina.com> wrote:
>
> Before you output the form:
> $r =& HTML_QuickForm::defaultRenderer();
> $r->setElementTemplate('...', 'name');
> Where '...' is the template you want to use. Look in the
> HTML/QuickForm/Renderer/Default.php for the default element template.
Sweet! That did it Justin. Thank you very much!
Carpe viam,
Mike
Michael Larocque
Chief Cook and Bottle Washer
Prolumina Communications Inc.
http://prolumina.com/~mlarocque/
|
|
|
|
|