如何更改 "select box" 表单的大小

How to change the size of a "select box" form

客户不想在 select 表单中滚动,所以我需要增加 select 表单的大小。

我试过了,但还是不行,我只看到 4 个输入:

{{ form_widget(filterForm.accomodationFilter1, { attr: { class: 'fancyselect filter type' }, {'size': '10'} }) }}

知道我该怎么做吗?文档在哪里?

谢谢

尝试直接在 formBuilder 中执行此操作:

->add('example', 'choice', array(
            'attr' => array('class' => 'fancyselect filter type',
                             'style' => 'max-width:100px'),
            'choices' => 'choices',
            )

或者直接使用:

->add('example', 'choice', array(
            'attr' => array('class' => 'fancyselect filter type'),
            'choices' => 'choices',
            'max_length' => 100,
            )