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
Ok, found my mistake, the code should be:
{{ form_widget(form.type, {value: "28" } ) }}
I forgot the quotes for the id. And also, there is a need to CTRL + F5 to refresh the page and see the difference.
as @Elium1984 suggested
{{ form_widget(form.type, {value: twig_var ~ "" } ) }}
or
{{ form_row(form.type, {value: twig_var ~ "" } ) }}