search

Home  >  Q&A  >  body text

Custom default terms and conditions checkbox in Symfony 5

I'm new to symfony and I'm trying to build my registration page. The form and fields are generated through my FormType but I kinda want to change the look of the terms and conditions checkbox.

By default it's label then box, I want to reverse them and put my label on the right side of the box. Is there a way to solve this problem? Thank you in advance!

P粉463811100P粉463811100275 days ago1532

reply all(1)I'll reply

  • P粉423694341

    P粉4236943412024-04-05 19:02:45

    I guess you are using {{ form(form) }} to render the form in twig.

    But when you use something like this, you can decide how to render the various parts of the form

    {{ form_start(form) }}
        
    {{ form_errors(form) }}
    {{ form_row(form.task) }}
    {{ form_row(form.dueDate) }}
    {{ form_end(form) }}

    With this knowledge, you should be able to place the label on the right side.

    View documentation. There is a nice image that describes the various parts of the form and how to access/render it in twig.

    https://symfony.com/doc/current/form/form_customization.html

    reply
    0
  • Cancelreply