Three Zend_Form tips

I have compiled a short list of Zend_Form tips I find very useful yet are not mentioned in the documentation and are hard to come across (unless you want to spend hours digging old Nabble threads):

Checkbox label placement

The default checkbox placement is on the right side of its label. This can be easily changed by setting the placement option of the Label decorator (allowed values are APPEND and PREPEND):

$element->addDecorator('Label', array('placement' => 'APPEND'));

Inline radio buttons

By default radio buttons are separated with <br /> tags which causes every radio button to display on a single line. To display all radio buttons on a single line:


Unescaped labels

Sometimes you will need to display a link (or any other XHTML markup) inside labels:

$element->addDecorator('Label', array('escape' => false));


  1. Asmund · July 21, 2009

    Great tips!

    Using setSeparator was really useful to me!
    Just want to mention how useful it is to do create everything in one go:

    $this->addElement('radio', '<name>', array(
    'label' => '<label>',
    'decorators' => array('ViewHelper',
    array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')),
    array(array('td' => 'HtmlTag'), array('tag' => 'td')),
    array('Label', array('tag' => 'td'))
    'multiOptions' => array(
    '<option1>' => '<option1 label>',
    '<option2>' => '<option2 label>',
    separator => ''


  2. Michael · July 21, 2009

    Wow, by far this was the most helpfull Article I read in 2013. Ok, it’s only the 11th of 365 days, but anyway, super short and informative article. Thanks