1

I am using zend form to create an radio button element. How do I align them horizontally.

$this->addElement('radio', 'howYouFeel3', array(
    'onClick' => 'showFields(this);',
    'required' => true,
    'multiOptions' => array(
            'Positive' => 'Positive',
            'negative' => 'Negative',
    )
));

I have tried adding:

'setSep' => '',

and

'separator' => '',

and

'setSeparator' => ''

But none worked.

Also tried:

$howYouFeel3 = new Zend_Form_Element_Radio('howYouFeel3');
        $howYouFeel3
            ->setLabel('How you Feel?')
                    ->setSeparator('')
            ->addMultiOptions(array(
                    'positive' => 'Positive',
                    'negative' => 'Negative'
                    ));

        $this->addElement($howYouFeel3);

Have looked at the source code and it seems the code is creating the radio buttons in li tags in an ul unlike others in the situation with the same problem who have an
at the end. This is perhaps why the seperator thing doesnt work.

RSM
  • 14,540
  • 34
  • 97
  • 144

2 Answers2

1

This question has been asked before here, the accepted answer should show you how to go about this.

Edit: Have you tried: array("listsep" => ' ')

It seems to be the universal solution, here is another example

Community
  • 1
  • 1
Phil
  • 10,948
  • 17
  • 69
  • 101
  • 1
    Can you show me how you tried to use the solution from the previously asked question using `->setSeparator('')`? – Phil Sep 06 '12 at 14:19
  • I don't know dude, I up-voted your question in hopes that someone else has the answer. – Phil Sep 06 '12 at 14:43
0

You can use setSeperator function to align the radiobuttons

$radio= new Zend_Form_Element_Radio('status');
$radio->setSeparator('&nbsp');

Nandakumar V
  • 4,317
  • 4
  • 27
  • 47