Skip to content

Help block is not shown for a CheckboxType field #29135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
watlf opened this issue Nov 8, 2018 · 7 comments
Closed

Help block is not shown for a CheckboxType field #29135

watlf opened this issue Nov 8, 2018 · 7 comments

Comments

@watlf
Copy link

watlf commented Nov 8, 2018

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) }}
@xabbuh
Copy link
Member

xabbuh commented Nov 8, 2018

Which form theme do you use?

@watlf
Copy link
Author

watlf commented Nov 8, 2018

I use a custom layout that consist of a few lines:

{% block form_label_class -%}
col-sm-4
{%- endblock form_label_class %}

{% block form_group_class -%}
col-sm-8
{%- endblock form_group_class %}

@xabbuh
Copy link
Member

xabbuh commented Nov 8, 2018

Would you like to create a small example application including your form theme that allows to reproduce the issue?

@apfelbox
Copy link
Contributor

apfelbox commented Nov 8, 2018

So I guess you are extending the bootstrap themes, as only they have these blocks.

The issue should be fixed in the Bootstrap v4, since #28113, but not sure about Bootstrap v3.

@watlf
Copy link
Author

watlf commented Nov 9, 2018

@apfelbox yep, you are right, this bug is reproduced for the bootstrap_3_layout as basic, but if I use bootstrap_4_layout everything works fine

@xabbuh
Copy link
Member

xabbuh commented Nov 24, 2018

Could you still create a small example application that allows to reproduce so we can see if and how we can fix it?

@xabbuh
Copy link
Member

xabbuh commented Dec 4, 2018

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants