I use symfony forms and i have serie of fields which have the same name + index number as follow: in0, in1, in2, in3...
Is it possible to loop names in TWIG like:
{% for i in 0..10 %}
{{ form_row(propForm."in"~i) }}
{% endfor %}
Thanks!
Try using attribute function as example:
{{ form_row(attribute(propForm, ("in"~i) ) ) }}
PS: remember to use the parenthesis to generate the attribute name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.