Skip to content

Help block is not shown for a CheckboxType field #29135

Closed
@watlf

Description

@watlf

Symfony version(s) affected: 4.1.0

Description
Help block is not shown for a CheckboxType field.

How to reproduce
Add some checkbox field in FormType

namespace App\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

class SomeCheckboxForm extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', TextType::class, [
            'label' => 'Name',
        ]);

        $builder->add('public', CheckboxType::class, array(
            'label'    => 'Public',
            'help' => 'message text',
        ));
    }
}

Create form in controller:

$checkbox = $this->createForm(SomeCheckboxForm::class)->createView();

And print it in view template:

    {{ form_start(checkbox) }}
    {{ form_widget(checkbox) }}
    {{ form_end(checkbox) }}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions