How can I put the asterisk of my required field on my label? (Symfony form) -


i working on symfony 3 , have trouble form.

when create symfony form field not required, here code :

i create form :

$form = $this->createformbuilder()   ->add('prenom' texttype::class, array(     'label'    => 'votre prénom',     'required' => false   )   ->getform(); 

here code in view field:

{{ form_label(form.prenom) }} {{ form_errors(form.prenom) }} {{ form_widget(form.prenom) }} 

and html have :

<label class="control-label" for="contact_prenom">votre prénom</label> <input type="text" id="contact_prenom" name="contact[prenom]" class="form-control"/> 

now if same without 'require' => false on formbuilder, here html get:

<label class="control-label required" for="contact_prenom">votre prénom</label> <sup class="required" title="champ obligatoire">         <i class="fa fa-asterisk"></i> </sup> <input type="text" id="contact_prenom" name="contact[prenom]" required="required" class="form-control" /> 

is possible control "sup" tag asterisk * can label?

i guess can jquery, i'd know if it possible on form builder or in twig?

in doc there specific section here http://symfony.com/doc/current/form/form_customization.html#adding-a-required-asterisk-to-field-labels

you can css only

label.required:before {     content: "* "; } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -