Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TWIG] File input, visible but no text #31159

Closed
@jean-gerard

Description

@jean-gerard

Symfony version(s) affected: x4.2.7

Description

The bootstrap file input field is visible but has no text in it.

image

But if I add

.custom-file-input {
  opacity: 1!important;
}

The text is visible but the ugly button is too.

image

How to reproduce

I am using the bootstrap 4 template.

#config/packages/twig.yaml
twig:
    paths: ['%kernel.project_dir%/templates']
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    form_themes: ['bootstrap_4_layout.html.twig']

Generating the form like so :

$builder->add(
                'datafile',
                FileType::class,
                [
                    'label' => 'main.form.file',
                ]
);

And displaying it like so :

<div class="col-md-12 col-lg-6" id="main-form-holder">
    <div class="row form-group">
        <div class="col-md-3">{{ form_label(form.datafile) }}</div>
        <div class="col-md-9">{{ form_widget(form.datafile) }}</div>
    </div>
</div>

This problem appeared after updating from Symfony 4.0 to symfony 4.2 .

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