Skip to content

Commit 107875a

Browse files
authored
Added tip for files input rendering
Added a tip about files input rendering in order to enable the display of the selected file.
1 parent 99d796e commit 107875a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

form/bootstrap4.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ Checkboxes and Radios
9292
For a checkbox/radio field, calling ``form_label()`` doesn't render anything.
9393
Due to Bootstrap internals, the label is already rendered by ``form_widget()``.
9494

95+
File inputs
96+
-----------
97+
98+
Files input are rendered using the Bootstrap "custom-file" class.
99+
100+
Due to Bootstrap internals, the rendered field does not display the selected filename.
101+
To fix that missing display, you can use the "`bs-custom-file-input`_" plugin (vanilla javascript), as recommended by `Bootstrap Forms documentation`_.
102+
95103
Accessibility
96104
-------------
97105

@@ -116,4 +124,6 @@ and ``checkbox-custom`` respectively.
116124
{{ form_row(form.myCheckbox, {label_attr: {class: 'checkbox-custom'} }) }}
117125
118126
.. _`WCAG 2.0 standard`: https://www.w3.org/TR/WCAG20/
127+
.. _`bs-custom-file-input`: https://www.npmjs.com/package/bs-custom-file-input
128+
.. _`Bootstrap Forms documentation`: https://getbootstrap.com/docs/4.4/components/forms/#file-browser
119129
.. _`custom forms`: https://getbootstrap.com/docs/4.4/components/forms/#custom-forms

0 commit comments

Comments
 (0)