Symfony – FormType – set field display:none by default

  display, field, label, styles, symfony

in my formType on Symfony I try to hide a default field.

So I did like this:

        ->add('amountReduction', NumberType::class, [
            "required" => false,
            "label" => "Montant de la r├ęduction",
            "attr" => [
                "style" => "width: 200px; display: none;"

The problem is that the label is still visible. I would like to display: none; the whole field by default.

The goal is then that in the template, I can make a $(".field").show() which will display the label and the entire field

Thanks for your help

Source: Symfony Questions