Skip to content

Commit 8af6094

Browse files
committed
Added support for using the "{{ label }}" placeholder in constraint messages
1 parent f556637 commit 8af6094

32 files changed

+43
-0
lines changed

components/form.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,11 @@ and the errors will display next to the fields on error.
728728
For a list of all of the built-in validation constraints, see
729729
:doc:`/reference/constraints`.
730730

731+
.. versionadded:: 5.2
732+
733+
Constraint message can contains ``{{ label }}`` placeholder that will be replaced
734+
by corresponding form field label (in view of ``label_format`` option).
735+
731736
Accessing Form Errors
732737
~~~~~~~~~~~~~~~~~~~~~
733738

forms.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,11 @@ corresponding errors printed out with the form. Read the
548548
:doc:`Symfony validation documentation </validation>` to learn more about this
549549
powerful feature.
550550

551+
.. versionadded:: 5.2
552+
553+
Constraint message can contains ``{{ label }}`` placeholder that will be replaced
554+
by corresponding form field label (in view of ``label_format`` option).
555+
551556
Other Common Form Features
552557
--------------------------
553558

reference/constraints/Blank.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ You can use the following parameters in this message:
102102
Parameter Description
103103
=============== ==============================================================
104104
``{{ value }}`` The current (invalid) value
105+
``{{ label }}`` Corresponding form field label
105106
=============== ==============================================================
106107

107108
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/CardScheme.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ You can use the following parameters in this message:
112112
Parameter Description
113113
=============== ==============================================================
114114
``{{ value }}`` The current (invalid) value
115+
``{{ label }}`` Corresponding form field label
115116
=============== ==============================================================
116117

117118
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Choice.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ You can use the following parameters in this message:
392392
Parameter Description
393393
=============== ==============================================================
394394
``{{ value }}`` The current (invalid) value
395+
``{{ label }}`` Corresponding form field label
395396
=============== ==============================================================
396397

397398
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Currency.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ You can use the following parameters in this message:
9494
Parameter Description
9595
=============== ==============================================================
9696
``{{ value }}`` The current (invalid) value
97+
``{{ label }}`` Corresponding form field label
9798
=============== ==============================================================
9899

99100
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Date.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ You can use the following parameters in this message:
9898
Parameter Description
9999
=============== ==============================================================
100100
``{{ value }}`` The current (invalid) value
101+
``{{ label }}`` Corresponding form field label
101102
=============== ==============================================================
102103

103104
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/DateTime.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ You can use the following parameters in this message:
107107
Parameter Description
108108
=============== ==============================================================
109109
``{{ value }}`` The current (invalid) value
110+
``{{ label }}`` Corresponding form field label
110111
=============== ==============================================================
111112

112113
.. include:: /reference/constraints/_payload-option.rst.inc

reference/constraints/Email.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ You can use the following parameters in this message:
101101
Parameter Description
102102
=============== ==============================================================
103103
``{{ value }}`` The current (invalid) value
104+
``{{ label }}`` Corresponding form field label
104105
=============== ==============================================================
105106

106107
mode

reference/constraints/Expression.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ You can use the following parameters in this message:
260260
Parameter Description
261261
=============== ==============================================================
262262
``{{ value }}`` The current (invalid) value
263+
``{{ label }}`` Corresponding form field label
263264
=============== ==============================================================
264265

265266
.. include:: /reference/constraints/_payload-option.rst.inc

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy