Custom default terms and conditions checkbox in Symfony 5
P粉463811100
P粉463811100 2024-04-04 22:42:19
0
1
1482

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粉463811100
P粉463811100

reply all(1)
P粉423694341

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template