How to set the name of a form without a class?

后端 未结 5 1938
小鲜肉
小鲜肉 2020-12-17 10:32

Here is written how to set the name of a form with a class:

http://symfony.com/doc/2.0/book/forms.html#creating-form-classes

but how to set the name of this

5条回答
  •  天涯浪人
    2020-12-17 11:04

    In version 2.4.1 of Symfony, the solution is:

    $form = $this->createFormBuilder ( NULL, array ( 'attr' => array ( 'name' => 'myFormName', 'id' => 'myFormId' ) ) )
                ->add (..
    

    You can also set other form attributes this way, but I've not tried. Replace NULL with your data if you want.

提交回复
热议问题