Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c3c6772

Browse filesBrowse files
committed
feature #8488 [Form] Add documentation for new tel and color types (apetitpa, javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- [Form] Add documentation for new tel and color types https://symfony.com/blog/new-in-symfony-3-4-form-improvements#new-html5-types Commits ------- a0deed8 Explain the new ColorType a bit more 58d8aa3 Explain the new TelType a bit more 655a94b add doc for new tel and color types
2 parents 3315f32 + a0deed8 commit c3c6772
Copy full SHA for c3c6772

File tree

4 files changed

+139
-0
lines changed
Filter options

4 files changed

+139
-0
lines changed

‎reference/forms/types.rst

Copy file name to clipboardExpand all lines: reference/forms/types.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Form Types Reference
1919
types/search
2020
types/url
2121
types/range
22+
types/tel
23+
types/color
2224

2325
types/choice
2426
types/entity

‎reference/forms/types/color.rst

Copy file name to clipboard
+68Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. index::
2+
single: Forms; Fields; ColorType
3+
4+
ColorType Field
5+
===============
6+
7+
The ``ColorType`` field is a text field that is rendered using the HTML5
8+
``<input type="color">`` tag. Depending on each browser, the behavior of this
9+
form field can vary substantially. Some browsers display it as a simple text
10+
field, while others display a native color picker.
11+
12+
The value of the underlying ``<input type="color">`` field is always a
13+
7-character string specifying an RGB color in lower case hexadecimal notation.
14+
That's why it's not possible to select semi-transparent colors with this
15+
element.
16+
17+
+-------------+---------------------------------------------------------------------+
18+
| Rendered as | ``input`` ``color`` field (a text box) |
19+
+-------------+---------------------------------------------------------------------+
20+
| Inherited | - `data`_ |
21+
| options | - `disabled`_ |
22+
| | - `empty_data`_ |
23+
| | - `error_bubbling`_ |
24+
| | - `error_mapping`_ |
25+
| | - `label`_ |
26+
| | - `label_attr`_ |
27+
| | - `label_format`_ |
28+
| | - `mapped`_ |
29+
| | - `required`_ |
30+
| | - `trim`_ |
31+
+-------------+---------------------------------------------------------------------+
32+
| Parent type | :doc:`TextType </reference/forms/types/text>` |
33+
+-------------+---------------------------------------------------------------------+
34+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` |
35+
+-------------+---------------------------------------------------------------------+
36+
37+
Inherited Options
38+
-----------------
39+
40+
These options inherit from the :doc:`FormType </reference/forms/types/form>`:
41+
42+
.. include:: /reference/forms/types/options/data.rst.inc
43+
44+
.. include:: /reference/forms/types/options/disabled.rst.inc
45+
46+
.. include:: /reference/forms/types/options/empty_data.rst.inc
47+
:end-before: DEFAULT_PLACEHOLDER
48+
49+
The default value is ``''`` (the empty string).
50+
51+
.. include:: /reference/forms/types/options/empty_data.rst.inc
52+
:start-after: DEFAULT_PLACEHOLDER
53+
54+
.. include:: /reference/forms/types/options/error_bubbling.rst.inc
55+
56+
.. include:: /reference/forms/types/options/error_mapping.rst.inc
57+
58+
.. include:: /reference/forms/types/options/label.rst.inc
59+
60+
.. include:: /reference/forms/types/options/label_attr.rst.inc
61+
62+
.. include:: /reference/forms/types/options/label_format.rst.inc
63+
64+
.. include:: /reference/forms/types/options/mapped.rst.inc
65+
66+
.. include:: /reference/forms/types/options/required.rst.inc
67+
68+
.. include:: /reference/forms/types/options/trim.rst.inc

‎reference/forms/types/map.rst.inc

Copy file name to clipboardExpand all lines: reference/forms/types/map.rst.inc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Text Fields
1212
* :doc:`SearchType </reference/forms/types/search>`
1313
* :doc:`UrlType </reference/forms/types/url>`
1414
* :doc:`RangeType </reference/forms/types/range>`
15+
* :doc:`TelType </reference/forms/types/tel>`
16+
* :doc:`ColorType </reference/forms/types/color>`
1517

1618
Choice Fields
1719
~~~~~~~~~~~~~

‎reference/forms/types/tel.rst

Copy file name to clipboard
+67Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.. index::
2+
single: Forms; Fields; TelType
3+
4+
TelType Field
5+
===============
6+
7+
The ``TelType`` field is a text field that is rendered using the HTML5
8+
``<input type="tel">`` tag. Following the recommended HTML5 behavior, the value
9+
of this type is not validated in any way, because formats for telephone numbers
10+
vary too much depending on each country.
11+
12+
Nevertheless it may be useful to use this type in web applications because some
13+
browsers (e.g. smartphone browsers) adapt the input keyboard to make it easier
14+
to input phone numbers.
15+
16+
+-------------+---------------------------------------------------------------------+
17+
| Rendered as | ``input`` ``tel`` field (a text box) |
18+
+-------------+---------------------------------------------------------------------+
19+
| Inherited | - `data`_ |
20+
| options | - `disabled`_ |
21+
| | - `empty_data`_ |
22+
| | - `error_bubbling`_ |
23+
| | - `error_mapping`_ |
24+
| | - `label`_ |
25+
| | - `label_attr`_ |
26+
| | - `label_format`_ |
27+
| | - `mapped`_ |
28+
| | - `required`_ |
29+
| | - `trim`_ |
30+
+-------------+---------------------------------------------------------------------+
31+
| Parent type | :doc:`TextType </reference/forms/types/text>` |
32+
+-------------+---------------------------------------------------------------------+
33+
| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType` |
34+
+-------------+---------------------------------------------------------------------+
35+
36+
Inherited Options
37+
-----------------
38+
39+
These options inherit from the :doc:`FormType </reference/forms/types/form>`:
40+
41+
.. include:: /reference/forms/types/options/data.rst.inc
42+
43+
.. include:: /reference/forms/types/options/disabled.rst.inc
44+
45+
.. include:: /reference/forms/types/options/empty_data.rst.inc
46+
:end-before: DEFAULT_PLACEHOLDER
47+
48+
The default value is ``''`` (the empty string).
49+
50+
.. include:: /reference/forms/types/options/empty_data.rst.inc
51+
:start-after: DEFAULT_PLACEHOLDER
52+
53+
.. include:: /reference/forms/types/options/error_bubbling.rst.inc
54+
55+
.. include:: /reference/forms/types/options/error_mapping.rst.inc
56+
57+
.. include:: /reference/forms/types/options/label.rst.inc
58+
59+
.. include:: /reference/forms/types/options/label_attr.rst.inc
60+
61+
.. include:: /reference/forms/types/options/label_format.rst.inc
62+
63+
.. include:: /reference/forms/types/options/mapped.rst.inc
64+
65+
.. include:: /reference/forms/types/options/required.rst.inc
66+
67+
.. include:: /reference/forms/types/options/trim.rst.inc

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.