Nabilovish Bennani Nabilovish Bennani - 1 year ago 59
HTML Question

get name of css ID in a form in twig

I'm building a form in my sf2 project,so to provide a input I do in twig :

{{ form_widget(form.price) }}

the output is:

<input type="checkbox" value="1" required="required"

My question is: How to get the name or content of "id" only
in twig?

Because for every field I'll use the CSS id in Javascript code.

Answer Source

You can get all possible params with {{ dump(form.price) }}. If I remember correctly id accessable via {{ }}