I have a simply problem. I want just to create a checkbox widget with symfony so:
$builder->add("terms", CheckboxType::class, array('label'=>false));
But i obtain this output:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
<input id="fos_user_registration_form_terms" name="fos_user_registration_form[terms]" required="required" class=" checkbox" value="1" type="checkbox">
Terms
</label>
</div>
I want change text of label but when override the label attribut in PHP the output is:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required required">
<input id="fos_user_registration_form_terms" name="fos_user_registration_form[terms]" required="required" class=" checkbox" value="1" type="checkbox">
test
</label>
</div>
test
</label>
</div>
I have two label.
I will want obtain:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
<input id="fos_user_registration_form_terms" name="fos_user_registration_form[terms]" required="required" class=" checkbox" value="1" type="checkbox">
My label for accept terms with <a> tag
</label>
I use this bundle (BraincraftedBootstrapBundle)
Thank you for your help.
Render form like this:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
{{form_widget(form.terms)}}
My label for accept terms with
<a> tag </a>
</label>
</div>
Just render form widget and create label by hand.
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