RSM
RSM

Reputation: 15108

Align radio buttons horizontally

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.

Upvotes: 1

Views: 1119

Answers (2)

Nandakumar V
Nandakumar V

Reputation: 4615

You can use setSeperator function to align the radiobuttons

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

Upvotes: 0

Phil
Phil

Reputation: 11175

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

Upvotes: 1

Related Questions