8000 minor #13656 [Form] Added an html5 option to ColorType (javiereguiluz) · symfony/symfony-docs@3b2031b · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b2031b

Browse files
committed
minor #13656 [Form] Added an html5 option to ColorType (javiereguiluz)
This PR was squashed before being merged into the master branch. Discussion ---------- [Form] Added an html5 option to ColorType Fixes #13637. Commits ------- fcee158 [Form] Added an html5 option to ColorType
2 parents f39775d + fcee158 commit 3b2031b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

reference/forms/types/color.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ element.
1717
+-------------+---------------------------------------------------------------------+
1818
| Rendered as | ``input`` ``color`` field (a text box) |
1919
+-------------+---------------------------------------------------------------------+
20+
| Options | - `html5`_ |
21+
+-------------+---------------------------------------------------------------------+
2022
| Inherited | - `attr`_ |
2123
| options | - `data`_ |
2224
| | - `disabled`_ |
@@ -41,6 +43,22 @@ element.
4143

4244
.. include:: /reference/forms/types/options/_debug_form.rst.inc
4345

46+
Field Options
47+
-------------
48+
49+
html5
50+
~~~~~
51+
52+
**type**: ``bool`` **default**: ``false``
53+
54+
.. versionadded:: 5.1
55+
56+
This option was introduced in Symfony 5.1.
57+
58+
When this option is set to ``true``, the form type checks that its value matches
59+
the `HTML5 color format`_ (``/^#[0-9a-f]{6}$/i``). If it doesn't match it,
60+
you'll see the following error message: *"This value is not a valid HTML5 color"*.
61+
4462
Inherited Options
4563
-----------------
4664

@@ -83,3 +101,5 @@ The default value is ``''`` (the empty string).
83101
.. include:: /reference/forms/types/options/row_attr.rst.inc
84102

85103
.. include:: /reference/forms/types/options/trim.rst.inc
104+
105+
.. _`HTML5 color format`: https://www.w3.org/TR/html52/sec-forms.html#color-state-typecolor

0 commit comments

Comments
 (0)
0