开发者

Set width for dropdown menu in zend form

开发者 https://www.devze.com 2023-03-26 03:31 出处:网络
I am creating a drop down menu in zend form . I want to increse the width of the menu but it\'s failing.

I am creating a drop down menu in zend form . I want to increse the width of the menu but it's failing.

Here is the code for my dropdown

$this->addElement('select', 'user_role_id', array(
            'decorators' => array(
                'ViewHelper'
            ),
            'required'   => true,
            'label'      => 'Role',
            'width'       =>'930', 
            'multioptions'   => array(开发者_运维问答
                            '1' => 'Admin',
                            '2' => 'Manager',
                            '3'  => 'User'
                            ),
        ));


You can use the class attribute to assign a CSS class or add the width to the elements CSS manually:

AddClass

$user_role_id = $this->addElement('select', 'user_role_id');
$user_role_id->class = 'wide-select';

SetAttribs

$user_role_id = $this->addElement('select', 'user_role_id');
$user_role_id->setAttribs(array('style' => 'width: 930px;'));
0

精彩评论

暂无评论...
验证码 换一张
取 消