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
Post a Comment