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"
name="mybundle_appbundle_producttype[price]"
id="mybundle_appbundle_producttype_price">
My question is: How to get the name or content of "id" only mybundle_appbundle_producttype_price
in twig?
Because for every field I'll use the CSS id in Javascript code.
You can get all possible params with {{ dump(form.price) }}
. If I remember correctly id accessable via {{ form.price.vars.id }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With