Skip to content

Commit 5818046

Browse files
committed
minor #15237 Adding label_html for asterisk (ThomasLandauer)
This PR was submitted for the 5.2 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- Adding label_html for asterisk Closes #14915 I hope I got the link right - please double-check :-) Commits ------- a7ad737 Adding label_html for asterisk
2 parents 58f47ea + a7ad737 commit 5818046

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

form/bootstrap4.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ is a strong connection between the error and its ``<input>``, as required by the
8888
``form_label()`` internally. If you call to ``form_errors()`` in your template,
8989
you'll get the error messages displayed *twice*.
9090

91+
.. tip::
92+
93+
Since form errors are rendered *inside* the ``<label>``, you cannot use CSS
94+
``:after`` to append an asterisk to the label, because it would be displayed
95+
after the error message. Use the :ref:`label <reference-form-option-label-html>`
96+
option instead.
97+
9198
Checkboxes and Radios
9299
---------------------
93100

reference/forms/types/form.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ of the form type tree (i.e. it cannot be used as a form type on its own).
170170

171171
.. include:: /reference/forms/types/options/disabled.rst.inc
172172

173+
.. _reference-form-option-label:
174+
173175
.. include:: /reference/forms/types/options/label.rst.inc
174176

175177
.. include:: /reference/forms/types/options/row_attr.rst.inc

0 commit comments

Comments
 (0)