Thomas Clermont February 2016

symfony change attribut 'for' form_label

I search in google but i don't find how to change( surcharging) the 'for' attribut in a form_label.

{{ form_widget(form.star,{'id':'rating-input-1-5','attr':{'class':'rating-input'}}) }}
                                    {{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-5'}}) }}
                                    {{ form_widget(form.star,{'id':'rating-input-1-4','attr':{'class':'rating-input'}}) }}
                                    {{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-4'}}) }}
                                    {{ form_widget(form.star,{'id':'rating-input-1-3','attr':{'class':'rating-input'}}) }}
                                    {{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-3'}}) }}
                                    {{ form_widget(form.star,{'id':'rating-input-1-2','attr':{'class':'rating-input'}}) }}
                                    {{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-2'}}) }}
                                    {{ form_widget(form.star,{'id':'rating-input-1-1','attr':{'class':'rating-input'}}) }}
                                    {{ form_label(form.star,null,{'label_attr':{'class':'rating-star','for':'rating-input-1-1'}}) }}

I want that the form_label point on the id of my form_widget.

Is it possible ?

Thanks for your answer

Answers


Max P. February 2016

Try to change form_label call to

{{ form_label(form.star,null,{'id':'rating-input-1-5', 'label_attr':{'class':'rating-star'}}) }}

Post Status

Asked in February 2016
Viewed 1,145 times
Voted 11
Answered 1 times

Search




Leave an answer