-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
Description
Using Symfony 2.8.2 or 3.0.2.
You can reproduce the problem with this simple statement:
$builder->add('participation', ChoiceType::class, array(
'choices' => [ 'yes' => true, 'no' => false ],
'placeholder' => 'Select a value',
'empty_data' => null,
'choices_as_values' => true,
));
Expected result:
<select name="filter[participation]" id="filter_participation">
<option value="">Select a value</option>
<option value="1">Yes</option>
<option selected="selected" value="0">No</option>
</select>
Actual result:
<select name="filter[participation]" id="filter_participation">
<option value="1">Yes</option>
<option selected="selected" value="">No</option>
</select>
Dump of choiceList:
As you can see, the placeholder is not rendered. If I add a new empty value in 'choices', I got an empty value in the view plus the placeholder value.