I have a Form in my twig template. One of the form fields is a dropdownlist that is created from an Entity in my form builder.
I would like to set the default value in my dropdown list, to be the id 28 for example.
I don't know how to do this in twig.
I tryed this:
{{ form_widget(form.type, {value: 28 } ) }}
But nothing changed, I still have the firs value that is by default.
I know that I can set a default value in the FormType class where I am creating my form builder, but I am looking for a twig way, it seems to me more elegant than to create the object in the formType class.
as @Elium1984 suggested
or
Ok, found my mistake, the code should be:
I forgot the quotes for the id. And also, there is a need to CTRL + F5 to refresh the page and see the difference.