Skip to content

[Form] Add documentation for new tel and color types #8488

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

Merged
merged 3 commits into from
Oct 13, 2017
Merged
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
2 changes: 2 additions & 0 deletions reference/forms/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Form Types Reference
types/search
types/url
types/range
types/tel
types/color

types/choice
types/entity
Expand Down
68 changes: 68 additions & 0 deletions reference/forms/types/color.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.. index::
single: Forms; Fields; ColorType

ColorType Field
===============

The ``ColorType`` field is a text field that is rendered using the HTML5
``<input type="color">`` tag. Depending on each browser, the behavior of this
form field can vary substantially. Some browsers display it as a simple text
field, while others display a native color picker.

The value of the underlying ``<input type="color">`` field is always a
7-character string specifying an RGB color in lower case hexadecimal notation.
That's why it's not possible to select semi-transparent colors with this
element.

+-------------+---------------------------------------------------------------------+
| Rendered as | ``input`` ``color`` field (a text box) |
+-------------+---------------------------------------------------------------------+
| Inherited | - `data`_ |
| options | - `disabled`_ |
| | - `empty_data`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `label_format`_ |
| | - `mapped`_ |
| | - `required`_ |
| | - `trim`_ |
+-------------+---------------------------------------------------------------------+
| Parent type | :doc:`TextType </reference/forms/types/text>` |
+-------------+---------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` |
+-------------+---------------------------------------------------------------------+

Inherited Options
-----------------

These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/data.rst.inc

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

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data.rst.inc
:start-after: DEFAULT_PLACEHOLDER

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

.. include:: /reference/forms/types/options/error_mapping.rst.inc

.. include:: /reference/forms/types/options/label.rst.inc

.. include:: /reference/forms/types/options/label_attr.rst.inc

.. include:: /reference/forms/types/options/label_format.rst.inc

.. include:: /reference/forms/types/options/mapped.rst.inc

.. include:: /reference/forms/types/options/required.rst.inc

.. include:: /reference/forms/types/options/trim.rst.inc
2 changes: 2 additions & 0 deletions reference/forms/types/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Text Fields
* :doc:`SearchType </reference/forms/types/search>`
* :doc:`UrlType </reference/forms/types/url>`
* :doc:`RangeType </reference/forms/types/range>`
* :doc:`TelType </reference/forms/types/tel>`
* :doc:`ColorType </reference/forms/types/color>`

Choice Fields
~~~~~~~~~~~~~
Expand Down
67 changes: 67 additions & 0 deletions reference/forms/types/tel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.. index::
single: Forms; Fields; TelType

TelType Field
===============

The ``TelType`` field is a text field that is rendered using the HTML5
``<input type="tel">`` tag. Following the recommended HTML5 behavior, the value
of this type is not validated in any way, because formats for telephone numbers
vary too much depending on each country.

Nevertheless it may be useful to use this type in web applications because some
browsers (e.g. smartphone browsers) adapt the input keyboard to make it easier
to input phone numbers.

+-------------+---------------------------------------------------------------------+
| Rendered as | ``input`` ``tel`` field (a text box) |
+-------------+---------------------------------------------------------------------+
| Inherited | - `data`_ |
| options | - `disabled`_ |
| | - `empty_data`_ |
| | - `error_bubbling`_ |
| | - `error_mapping`_ |
| | - `label`_ |
| | - `label_attr`_ |
| | - `label_format`_ |
| | - `mapped`_ |
| | - `required`_ |
| | - `trim`_ |
+-------------+---------------------------------------------------------------------+
| Parent type | :doc:`TextType </reference/forms/types/text>` |
+-------------+---------------------------------------------------------------------+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType` |
+-------------+---------------------------------------------------------------------+

Inherited Options
-----------------

These options inherit from the :doc:`FormType </reference/forms/types/form>`:

.. include:: /reference/forms/types/options/data.rst.inc

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

.. include:: /reference/forms/types/options/empty_data.rst.inc
:end-before: DEFAULT_PLACEHOLDER

The default value is ``''`` (the empty string).

.. include:: /reference/forms/types/options/empty_data.rst.inc
:start-after: DEFAULT_PLACEHOLDER

.. include:: /reference/forms/types/options/error_bubbling.rst.inc

.. include:: /reference/forms/types/options/error_mapping.rst.inc

.. include:: /reference/forms/types/options/label.rst.inc

.. include:: /reference/forms/types/options/label_attr.rst.inc

.. include:: /reference/forms/types/options/label_format.rst.inc

.. include:: /reference/forms/types/options/mapped.rst.inc

.. include:: /reference/forms/types/options/required.rst.inc

.. include:: /reference/forms/types/options/trim.rst.inc