Reputation:
With Symfony 3.3, I already try something like this, but no response:
<tr>
{% for choice in form.vars.value.clients %}
<td>{{ choice.value }}</td>
{% endfor %}
</tr>
Here is my formType:
$builder->add('name')
->add('contact')
->add('idprofession')
->add('idcard');
I have changed nothing because for the foreign key it is by default a choice, I want to recover the value of id profession
Upvotes: 3
Views: 3982
Reputation: 39380
You can use selectedchoice
Twig test:
<option {% if choice is selectedchoice(value) %} selected="selected"{% endif %} ...>
As described here in the doc.
Hope this help
Upvotes: 0
Reputation: 2180
Did you try form.clients.vars.value
?
as this should give you the value that is selected
Upvotes: 1