Reputation: 261
I need to give a value to my select, but i don't find how add a attr selected to my option.
i would like something like that :
{{ form_widget(form.zone,{ 'option' : {'selected' : 7 }}) }}
for selected my option with the value '7', its possible ?
Sorry for my bad english.
Upvotes: 0
Views: 1710
Reputation: 261
Thanks for your answer. I have already try this, my select had this value, but option with this value is not selected.
<select id="zone" value="7">
<option value="0">International</option>
<option value="7">Oceanie</option>
<option value="1">Union Europeenne</option>
...
and for this work i think i need :
<option selected='selected' value="7">Oceanie</option>
Upvotes: 1
Reputation: 1059
Try something like this:
{{ form_widget(form.zone,{ 'attr' : {'value' : 7 }}) }}
Upvotes: 0