Skip to content

Help block is not shown for a CheckboxType field #29135

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy