From: "Mark Steudel" on
Let’s say I have a series of radios:

QUICK FORM CODE:

$form = new HTML_QuickForm( ‘tes’t );

$form->addElement( ‘radio’, ‘varName’, ‘Option 1’ );
$form->addElement( ‘radio’, ‘varName’, ‘Option 2’ );
$form->addElement( ‘radio’, ‘varName’, ‘Option 3’ );

Let’s say I wanted to change the template for the middle option. The way
that I have worked with the basic renderer is doing something like:

$form = new HTML_QuickForm( ‘test’ );

$template= '<the quickform element>';

$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate($template, 'varName' );

But if I do the above, it'll affect all of the radios, and I just want to
affect one of them.

How would I go about doing that?

Thanks, Mark
-------------------------------------------------
Mark Steudel
e: msteudel(a)gmail.com
p: 206.375.7244
f: 206.260.3021
 
.. : Our Work : .
http://www.mindfulinteractive.com
 
.. : Our Play : .
http://www.steudel.org/blog


From: Alexey Borzov on
Hi Mark,

Mark Steudel wrote:
> Let�s say I have a series of radios:
>
> QUICK FORM CODE:
>
> $form = new HTML_QuickForm( �tes�t );
>
> $form->addElement( �radio�, �varName�, �Option 1� );
> $form->addElement( �radio�, �varName�, �Option 2� );
> $form->addElement( �radio�, �varName�, �Option 3� );
>
> Let�s say I wanted to change the template for the middle option. The way
> that I have worked with the basic renderer is doing something like:
>
> $form = new HTML_QuickForm( �test� );
>
> $template= '<the quickform element>';
>
> $renderer =& $form->defaultRenderer();
> $renderer->setElementTemplate($template, 'varName' );
>
> But if I do the above, it'll affect all of the radios, and I just want to
> affect one of them.
>
> How would I go about doing that?

QuickForm isn't designed for that sort of thing, unfortunately.

You may try adding these radiobuttons as a group and playing with group
separators, but that won't quite work if there are other elements added between
these radiobuttons.

Or, you may try adding each radio as a group with a couple of 'static' elements
around, make sure to set $appendName to false.