Symfony2输入组表单标签

时间:2014-10-30 06:51:35

标签: symfony twig

{{ form_label(form.heapStartDate, '',{'label_attr': {'class': 'form-label'}}) }}
<div class="input-group form-group col-lg-12">
{{ form_widget(form.heapStartDate, {'attr':{'class': 'form-control datepicker ', 'placeholder': 'HEAP Start date','data-toggle':'tooltip','title':'Home Energy Asss. Program start date','data-placement':'top'}}) }}
<label for="ess_customerbundle_customer_heapStartDate" class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i>
</label>
</div>
{{ form_errors(form.heapStartDate) }}

我正在为“label for”属性使用静态值。我希望它是动态的。如何只在树枝上获得标签的价值?

1 个答案:

答案 0 :(得分:2)

尝试使用它:

<label for="{{ form.heapStartDate.vars.id }}" class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i>