2014-10-30 75 views
0
{{ 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」屬性的靜態值。我希望它是動態的。如何只在樹枝獲取標籤的價值Symfony2輸入組窗體標籤

回答

2

嘗試使用此:

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