From 655a94bbbe61b383b5b0b3111218e0ed4152f847 Mon Sep 17 00:00:00 2001 From: apetitpa Date: Sat, 7 Oct 2017 09:54:43 +0200 Subject: [PATCH 1/3] add doc for new tel and color types --- reference/forms/types.rst | 2 + reference/forms/types/color.rst | 61 +++++++++++++++++++++++++++++++ reference/forms/types/map.rst.inc | 2 + reference/forms/types/tel.rst | 61 +++++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 reference/forms/types/color.rst create mode 100644 reference/forms/types/tel.rst diff --git a/reference/forms/types.rst b/reference/forms/types.rst index d3457f50707..54cb8656707 100644 --- a/reference/forms/types.rst +++ b/reference/forms/types.rst @@ -19,6 +19,8 @@ Form Types Reference types/search types/url types/range + types/tel + types/color types/choice types/entity diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst new file mode 100644 index 00000000000..30294c193fa --- /dev/null +++ b/reference/forms/types/color.rst @@ -0,0 +1,61 @@ +.. index:: + single: Forms; Fields; ColorType + +ColorType Field +=============== + +The ``ColorType`` field is a text field that is rendered using the HTML5 +```` tag. + ++-------------+---------------------------------------------------------------------+ +| 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 ` | ++-------------+---------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` | ++-------------+---------------------------------------------------------------------+ + +Inherited Options +----------------- + +These options inherit from the :doc:`FormType `: + +.. 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 diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index 9c11b5cc5a7..b6ef2728ff9 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -12,6 +12,8 @@ Text Fields * :doc:`SearchType ` * :doc:`UrlType ` * :doc:`RangeType ` +* :doc:`TelType ` +* :doc:`ColorType ` Choice Fields ~~~~~~~~~~~~~ diff --git a/reference/forms/types/tel.rst b/reference/forms/types/tel.rst new file mode 100644 index 00000000000..72708d93e0b --- /dev/null +++ b/reference/forms/types/tel.rst @@ -0,0 +1,61 @@ +.. index:: + single: Forms; Fields; TelType + +TelType Field +=============== + +The ``TelType`` field is a text field that is rendered using the HTML5 +```` tag. + ++-------------+---------------------------------------------------------------------+ +| 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 ` | ++-------------+---------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType` | ++-------------+---------------------------------------------------------------------+ + +Inherited Options +----------------- + +These options inherit from the :doc:`FormType `: + +.. 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 From 58d8aa3e3ad8ba8c08e15c105ad5271b968ad0d5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 9 Oct 2017 15:26:16 +0200 Subject: [PATCH 2/3] Explain the new TelType a bit more --- reference/forms/types/tel.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/tel.rst b/reference/forms/types/tel.rst index 72708d93e0b..a409978b7ad 100644 --- a/reference/forms/types/tel.rst +++ b/reference/forms/types/tel.rst @@ -5,7 +5,13 @@ TelType Field =============== The ``TelType`` field is a text field that is rendered using the HTML5 -```` tag. +```` 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) | From a0deed8ef2658652febf002aa2c94bcb25478306 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 9 Oct 2017 15:29:45 +0200 Subject: [PATCH 3/3] Explain the new ColorType a bit more --- reference/forms/types/color.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst index 30294c193fa..dd7c39923ad 100644 --- a/reference/forms/types/color.rst +++ b/reference/forms/types/color.rst @@ -5,7 +5,14 @@ ColorType Field =============== The ``ColorType`` field is a text field that is rendered using the HTML5 -```` tag. +```` 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 ```` 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) |