symfony - How can I add an extra option in the dropdown generated by form? -


i've form builder this:

public function buildform(formbuilderinterface $builder, array $options) {     $builder         ->add('file','file')         ->add('concurs','entity', array('class' => 'mcfrontendbundle:concurs'))     ; } 

as can see, shows input select file, , dropdown select option filled concurs entity.

can add manually option "none"?

the entity form type, or particular choice types, has option called empty_value, need.

public function buildform(formbuilderinterface $builder, array $options) {     $builder         ->add('file','file')         ->add('concurs','entity', array(             'class' => 'mcfrontendbundle:concurs',             'empty_value' => 'none',             'required' => false         ))     ; } 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -