Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default value of Symfony 2 form field in Twig

Is it possible to set default value of input field in Twig ?

I am rendering form row with:

{{ form_widget(form.title) }} 

I want to be able to set default value like:

{{ form_widget(form.title, {data : 'Default title'}) }} 

Is it even possible ?

like image 831
hsz Avatar asked Dec 17 '12 14:12

hsz


1 Answers

Magic keyword for default value is value, not data.

{{ form_widget(form.title, {'value' : 'Default title'}) }} 
like image 140
hsz Avatar answered Sep 21 '22 02:09

hsz