简体   繁体   中英

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.

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

您可以使用setSeperator函数对齐单选按钮

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM