symfony - Twig: how to override id attribute of form_widget? -
this question has answer here:
- customize widget's id attribute in twig 3 answers
so pretty straightforward question solution seems not straightforward twig beginner myself. basically, want apply javascript set of forms, need field id's remain same across different forms (or somehow inject these id's javascript file i'm not sure how if external).
i use render textarea widget:
{{ form_widget(form.text) }} which automatically gives id want change. doing this:
{{ form_widget(form.text, {'attr': {'id': 'ootn_blogbundle_entry_text') }} just adds id field , since there 2 of them, second 1 (mine) ignored.
how tell form_widget give textarea different id?
try {{ form_widget(form.title, { 'id': 'my_custom_id' }) }}
Comments
Post a Comment