[英]symfony twig variables in form field
I have a number of fields in my FromType file that have name : 我的FromType文件中有许多名称为的字段:
//formType.php
for($i=0;$i<N;$i++){
->add('matricola_'.$i, TextType::class, array(
/*....*/
->add('tipologia_'.$i, TextType::class, array(
/*....*/
->add('esame_'.$i, TextType::class, array(
/*....*/
}
I don't understand in twig file how i can write this fields in a for cicle 我不明白在树枝文件中如何在cicle中写入此字段
I try differente way but without any result. 我尝试不同的方式,但没有任何结果。
//twig file
{% for i in 0..10%}
<tr>
error <td>{{ form_widget(form.matricola_{{i}}) }}</td>
error <td>{{ form_widget(form.tipologia_{%i%}) }}</td>
error <td>{{ form_widget(form.esame_.i) }}</td>
</tr>
{% endfor %}
Please help me and sorry for my english 请帮助我,对不起我的英语
尝试
{{ form_widget(form['matricola_' ~ i]) }}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.