我正在我的 sf2 项目中构建一个表单,因此要提供我在 twig 中所做的输入:
{{ form_widget(form.price) }}
输出是:
<input type="checkbox" value="1" required="required"
name="mybundle_appbundle_producttype[price]"
id="mybundle_appbundle_producttype_price">
我的问题是:如何仅mybundle_appbundle_producttype_price
在树枝中获取“id”的名称或内容?
因为对于每个字段,我都会在 Javascript 代码中使用 CSS id。