From: "Andrea Bakker" on
Hi

I've been searching for hours to try and find a simple example on how to implement html_quickform_renderer in conjunction with an external stylesheet. Can you suggest a good link.

Thanks
Andrea
From: Mark Steudel on
I'm curious what are you trying to do?

MS

On Thu, Mar 4, 2010 at 4:25 AM, Andrea Bakker <abakker(a)telkomsa.net> wrote:
> Hi
>
> I've been searching for hours to try and find a simple example on how to implement html_quickform_renderer in conjunction with an external stylesheet.   Can you suggest a good link.
>
> Thanks
> Andrea



--

-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel(a)gmail.com

.. : Work : .
http://www.mindfulinteractive.com

.. : Play : .
http://www.steudel.org/blog
From: Mark Steudel on
Ok so the basic idea is that the form, element all have various
"templates", for example this is the basic element (element being a
input, select) template:

"\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required
--><span style=\"color: #ff0000\">*</span><!-- END required
--><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!--
BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!--
END error -->\t{element}</td>\n\t</tr>"

You can see the place holders for the element {element}, errors, etc.

To edit an elements template (say you want to remove the table
structure and wrap the element in a div) you can do it in the
following manner:

// instantiate quickform
$form = new HTML_QuickForm('orderForm' );

// get the forms default renderer
$renderer =& $form->defaultRenderer();

// create an element
$form->addElement( 'text', 'test', 'Test Element' );

// my new form element template
$newTemplate = "<div class="newClass">{error}{element}{label}</div>";

// apply template to specific element
$renderer->setElementTemplate($newTemplate, 'test');

// to apply to all ememnets
$renderer->setElementTemplate($newTemplate);


Note you can of course just use css to target the various elements or
you can add classes/ids without editing the template

$form->addElement( 'text', 'test', 'Test Element', array(
'class'=>'newClass', 'id' => 'myId' ) );

Not sure if that is what you were looking for.

MS

On Fri, Mar 5, 2010 at 12:04 AM, Andrea Bakker <abakker(a)telkomsa.net> wrote:
> I'm trying to find a way to customize the look of the quickform by using an
> external css.   It looks like quickform_renderer is the way to go. But I
> can't find a good example on how to implement this.
>
> ----- Original Message ----- From: "Mark Steudel" <msteudel(a)gmail.com>
> To: "Andrea Bakker" <abakker(a)telkomsa.net>
> Cc: "pear general" <pear-general(a)lists.php.net>
> Sent: Thursday, March 04, 2010 5:28 PM
> Subject: Re: [PEAR] html_quickform_renderer
>
>
> I'm curious what are you trying to do?
>
> MS
>
> On Thu, Mar 4, 2010 at 4:25 AM, Andrea Bakker <abakker(a)telkomsa.net> wrote:
>>
>> Hi
>>
>> I've been searching for hours to try and find a simple example on how to
>> implement html_quickform_renderer in conjunction with an external
>> stylesheet. Can you suggest a good link.
>>
>> Thanks
>> Andrea
>
>
>
> --
>
> -----------------------------------------
> Mark Steudel
> P: 206.375.7244
> msteudel(a)gmail.com
>
> . : Work : .
> http://www.mindfulinteractive.com
>
> . : Play : .
> http://www.steudel.org/blog
>
>



--

-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel(a)gmail.com

.. : Work : .
http://www.mindfulinteractive.com

.. : Play : .
http://www.steudel.org/blog
From: Mark Steudel on
Also here's the intro for the basic renderer section in the manual:
http://pear.php.net/manual/en/package.html.html-quickform.intro-renderers.php

MS

On Sat, Mar 6, 2010 at 12:50 AM, Andrea Bakker <abakker(a)telkomsa.net> wrote:
> Yes, thank you so much ! That is exactly what I was interested in.
>
> Andrea
> ----- Original Message ----- From: "Mark Steudel" <msteudel(a)gmail.com>
> To: "Andrea Bakker" <abakker(a)telkomsa.net>; "pear-general"
> <pear-general(a)lists.php.net>
> Sent: Friday, March 05, 2010 4:05 PM
> Subject: Re: [PEAR] html_quickform_renderer
>
>
> Ok so the basic idea is that the form, element all have various
> "templates", for example this is the basic element (element being a
> input, select) template:
>
> "\n\t<tr>\n\t\t<td align=\"right\" valign=\"top\"><!-- BEGIN required
> --><span style=\"color: #ff0000\">*</span><!-- END required
> --><b>{label}</b></td>\n\t\t<td valign=\"top\" align=\"left\"><!--
> BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!--
> END error -->\t{element}</td>\n\t</tr>"
>
> You can see the place holders for the element {element}, errors, etc.
>
> To edit an elements template (say you want to remove the table
> structure and wrap the element in a div) you can do it in the
> following manner:
>
> // instantiate quickform
> $form = new HTML_QuickForm('orderForm' );
>
> // get the forms default renderer
> $renderer =& $form->defaultRenderer();
>
> // create an element
> $form->addElement( 'text', 'test', 'Test Element' );
>
> // my new form element template
> $newTemplate = "<div class="newClass">{error}{element}{label}</div>";
>
> // apply template to specific element
> $renderer->setElementTemplate($newTemplate, 'test');
>
> // to apply to all ememnets
> $renderer->setElementTemplate($newTemplate);
>
>
> Note you can of course just use css to target the various elements or
> you can add classes/ids without editing the template
>
> $form->addElement( 'text', 'test', 'Test Element', array(
> 'class'=>'newClass', 'id' => 'myId' ) );
>
> Not sure if that is what you were looking for.
>
> MS
>
> On Fri, Mar 5, 2010 at 12:04 AM, Andrea Bakker <abakker(a)telkomsa.net> wrote:
>>
>> I'm trying to find a way to customize the look of the quickform by using
>> an
>> external css. It looks like quickform_renderer is the way to go. But I
>> can't find a good example on how to implement this.
>>
>> ----- Original Message ----- From: "Mark Steudel" <msteudel(a)gmail.com>
>> To: "Andrea Bakker" <abakker(a)telkomsa.net>
>> Cc: "pear general" <pear-general(a)lists.php.net>
>> Sent: Thursday, March 04, 2010 5:28 PM
>> Subject: Re: [PEAR] html_quickform_renderer
>>
>>
>> I'm curious what are you trying to do?
>>
>> MS
>>
>> On Thu, Mar 4, 2010 at 4:25 AM, Andrea Bakker <abakker(a)telkomsa.net>
>> wrote:
>>>
>>> Hi
>>>
>>> I've been searching for hours to try and find a simple example on how to
>>> implement html_quickform_renderer in conjunction with an external
>>> stylesheet. Can you suggest a good link.
>>>
>>> Thanks
>>> Andrea
>>
>>
>>
>> --
>>
>> -----------------------------------------
>> Mark Steudel
>> P: 206.375.7244
>> msteudel(a)gmail.com
>>
>> . : Work : .
>> http://www.mindfulinteractive.com
>>
>> . : Play : .
>> http://www.steudel.org/blog
>>
>>
>
>
>
> --
>
> -----------------------------------------
> Mark Steudel
> P: 206.375.7244
> msteudel(a)gmail.com
>
> . : Work : .
> http://www.mindfulinteractive.com
>
> . : Play : .
> http://www.steudel.org/blog
>
>



--

-----------------------------------------
Mark Steudel
P: 206.375.7244
msteudel(a)gmail.com

.. : Work : .
http://www.mindfulinteractive.com

.. : Play : .
http://www.steudel.org/blog