Skip to content

[Form] Documented the html5 option of Money and Percent #14285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions reference/forms/types/money.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ how the input and output of the data is handled.
| Options | - `currency`_ |
| | - `divisor`_ |
| | - `grouping`_ |
| | - `html5`_. |
| | - `rounding_mode`_ |
| | - `scale`_ |
+-------------+---------------------------------------------------------------------+
Expand Down Expand Up @@ -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 ``<input type="number">`` 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
Expand Down Expand Up @@ -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
19 changes: 18 additions & 1 deletion reference/forms/types/percent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ the input.
+-------------+-----------------------------------------------------------------------+
| Rendered as | ``input`` ``text`` field |
+-------------+-----------------------------------------------------------------------+
| Options | - `rounding_mode`_ |
| Options | - `html5`_ |
| | - `rounding_mode`_ |
| | - `scale`_ |
| | - `symbol`_ |
| | - `type`_ |
Expand Down Expand Up @@ -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 ``<input type="number">`` 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
Expand Down Expand Up @@ -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