当前位置: 动力学知识库 > 问答 > 编程问答 >

forms - How Can I get autofocus on the first element (buildform) symfony

问题描述:

In my TopicType class, I used :

public function buildForm(FormBuilderInterface $builder, array $options)

{

$builder

->add('title', 'text')

->add('content', 'ckeditor', array(

'label' => 'Contenu',

'config_name' => 'my_custom_config',

'config' => array('language' => 'fr'),))

->add('save', 'submit')

;

}

How can I get autofocus on my first field "title", when i display the form?

网友答案:
$builder->add('title', 'text', array(
    'attr' => array(
        'autofocus' => true
        )
    );
分享给朋友:
您可能感兴趣的文章:
随机阅读: