From ed2da35b1dff210f2d1890cfa56f75324e842295 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 25 Sep 2020 15:09:43 +0200 Subject: [PATCH] [Form] Documented the html5 option of Money and Percent --- reference/forms/types/money.rst | 16 ++++++++++++++++ reference/forms/types/percent.rst | 19 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 9fd1d4a95f4..046b23a4d72 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -17,6 +17,7 @@ how the input and output of the data is handled. | Options | - `currency`_ | | | - `divisor`_ | | | - `grouping`_ | +| | - `html5`_. | | | - `rounding_mode`_ | | | - `scale`_ | +-------------+---------------------------------------------------------------------+ @@ -88,6 +89,20 @@ be set back on your object. .. include:: /reference/forms/types/options/grouping.rst.inc +html5 +~~~~~ + +**type**: ``bool`` **default**: ``false`` + +.. versionadded:: 5.2 + + This option was introduced in Symfony 5.2. + +When this option is set to ``true``, Symfony renders the form field using an +HTML5 ```` element. In addition, the value is formatted +according to `HTML5 number format`_, which is similar to English locale but +doesn't groups numbers in thousands (e.g. ``1474.67``). + .. include:: /reference/forms/types/options/rounding_mode.rst.inc scale @@ -161,3 +176,4 @@ money_pattern ``string`` The format to use to display the money, including the .. _`3 letter ISO 4217 code`: https://en.wikipedia.org/wiki/ISO_4217 .. _`rounding errors`: https://0.30000000000000004.com/ +.. _`HTML5 number format`: https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index ca6c1c2e456..4c4d2c14607 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -15,7 +15,8 @@ the input. +-------------+-----------------------------------------------------------------------+ | Rendered as | ``input`` ``text`` field | +-------------+-----------------------------------------------------------------------+ -| Options | - `rounding_mode`_ | +| Options | - `html5`_ | +| | - `rounding_mode`_ | | | - `scale`_ | | | - `symbol`_ | | | - `type`_ | @@ -51,6 +52,20 @@ the input. Field Options ------------- +html5 +~~~~~ + +**type**: ``bool`` **default**: ``false`` + +.. versionadded:: 5.2 + + This option was introduced in Symfony 5.2. + +When this option is set to ``true``, Symfony renders the form field using an +HTML5 ```` element. In addition, the value is formatted +according to `HTML5 number format`_, which is similar to English locale but +doesn't groups numbers in thousands (e.g. ``30.75``). + .. include:: /reference/forms/types/options/rounding_mode.rst.inc .. versionadded:: 5.1 @@ -146,3 +161,5 @@ The default value is ``''`` (the empty string). .. include:: /reference/forms/types/options/required.rst.inc .. include:: /reference/forms/types/options/row_attr.rst.inc + +.. _`HTML5 number format`: https://www.w3.org/TR/html51/sec-forms.html#date-time-and-number-formats