Reputation: 88
{{ form_widget(form.category,{value:"3"}) }} //works!!
{{ form_widget(form.category,{value:'3'}) }} //works!!
{{ form_widget(form.category,{value:3}) }} // doesn't work !!
{{lastCatId}} // echos 3 !!!
{{ form_widget(form.category,{value:"lastCatId"}) }} //doesn't work ???
{{ form_widget(form.category,{value:'lastCatId'}) }} //doesn't work ???
I know after symfony 2.3. Value has to be quoted or double quoted. But I don't know why the variable doesnt work
Upvotes: 2
Views: 2162
Reputation: 88
never mind. I found the problem
{{ form_widget(form.category,{'value' : lastCatId|number_format }) }}
I had to cast it to int.
Upvotes: 2