Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display Zend_Form_Element_Radio on one line

The radio buttons in Zend Framework are displayed in a column (one option per line). How can I remove the br tag from the markup so that all radio options stay in one line?

My decorators are:

private $radioDecorators = array(
    'Label',
    'ViewHelper',
    array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'radio')),
    array(array('row' => 'HtmlTag'), array('tag' => 'li')),
);
like image 897
Richard Knop Avatar asked Jul 21 '09 22:07

Richard Knop


1 Answers

You need to call the setSeparator method on the Zend_Form_Element_Radio object, passing it ''. Here's an example from here:

<?php     

class CustomForm extends Zend_Form
{
  public function init()
  {
    $this->setMethod('post');
    $this->setAction('user/process');
    $gender = new Zend_Form_Element_Radio('gender');
    $gender->setLabel('Gender:')
      ->addMultiOptions(array(
        'male' => 'Male',
        'female' => 'Female'
      ))
      ->setSeparator('');
  }
}
like image 119
Edward Dale Avatar answered Nov 15 '22 15:11

Edward Dale