0

I trying to set the default value in Twig template using;

{{ form_widget(client_form.countries_id, {'value': client.countriesId}) }}

the {{ dump(client.countriesId) }} returns 2 which is the value i wanted to set.

If i set like {{ form_widget(client_form.countries_id, {'value': "2"}) }} the value is correcty setted. The problem seems to be in quotes. How can I fix this? Thanks.

Jan Kuri
  • 927
  • 12
  • 17
  • possible duplicate of [Symfony2 Setting a default choice field selection](http://stackoverflow.com/questions/8073236/symfony2-setting-a-default-choice-field-selection) – Lkopo Sep 13 '14 at 13:32
  • I found a solution on [http://stackoverflow.com/questions/25326400/selected-value-in-twig][1]. [1]: http://stackoverflow.com/questions/25326400/selected-value-in-twig – Jan Kuri Sep 13 '14 at 14:02
  • 1
    Congratulations, now you know it isn't hard to search before posting same question :). – Lkopo Sep 13 '14 at 14:04

0 Answers0