Wrap the ViewHelper with a couple of HtmlTags and set the 'separator'
attribute to '</li><li>':

       $radio = new Zend_Form_Element_Radio('fooRadio', array('separator' =>
"</li>\n<li>"));
        $radio->setMultiOptions(array('foo', 'bar', 'baz'))
             ->setDecorators(array(
                  'ViewHelper',
                 array(array('liWrapper' => 'HtmlTag'), array('tag' =>
'li')),
                  array(array('ulWrapper' => 'HtmlTag'), array('tag' =>
'ul'))
              ));
       echo $radio;

output:

<ul><li>
<label for="fooRadio-0"><input type="radio" name="fooRadio" id="fooRadio-0"
value="0">foo</label></li>
<li><label for="fooRadio-1"><input type="radio" name="fooRadio"
id="fooRadio-1" value="1">bar</label></li>
<li><label for="fooRadio-2"><input type="radio" name="fooRadio"
id="fooRadio-2" value="2">baz</label></li></ul>


   -- Mon



On Wed, Sep 2, 2009 at 8:53 AM, Jon Lebensold<[email protected]> wrote:
> Hello all,
>
> I'm struggling to style my radio buttons.
>
> The default rendering uses <br /> like so:
>
> <form>
> First name:
> <input type="text" name="firstname" />
> <br />
> Last name:
> <input type="text" name="lastname" />
> </form>
>
> I'd like to wrap the radio buttons in a <ul> and have <li>'s
>
> any ideas?
>
> Best Regards,
> -
> Jon Lebensold
> http://www.zendcasts.com
>

Reply via email to