Reputation: 15796
I have a combo with all values coming from a OneToMany relationship.
I've made a custom form here src/MySociety/Bundle/MyBundle/Form/Type/PersonRegistrationType.php
This works well.
But I want to add another value first in that combo, which says something like "Choose something here".
What is the way to do this with Symfony?
Upvotes: 1
Views: 122
Reputation: 30995
Take this exemple :
->add('channels', 'entity', array(
'class' => 'MyBundle:Channel',
'multiple'=> false,
'property'=> 'label',
'mapped'=>false,
'empty_value' => "Choose a Channel",
))
You can add 'empty-value'... I hope it will work with your need....
Upvotes: 4