Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1934720

Browse files
committed
featuresymfony#3461 [Form] Deprecated max_length and pattern options (stefanosala)
This PR was merged into the master branch.Discussion----------[Form] Deprecated max_length and pattern optionsSeesymfony/symfony#10001| Q | A| ------------- | ---| Doc fix? | no| New docs? | no| Applies to | master| Fixed tickets | -Commits-------456da28 [Form] Deprecated max_length and pattern options
2 parentsd2faada +456da28 commit1934720

File tree

11 files changed

+29
-16
lines changed

11 files changed

+29
-16
lines changed

‎book/forms.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,8 @@ the correct values of a number of field options.
709709
(i.e. is the field ``nullable``). This is very useful, as your client-side
710710
validation will automatically match your validation rules.
711711

712-
* ``max_length``: If the field is some sort of text field, then the ``max_length``
713-
option can be guessed from the validation constraints (if ``Length`` or
712+
* ``maxlength``: If the field is some sort of text field, then the ``maxlength``
713+
optionattributecan be guessed from the validation constraints (if ``Length`` or
714714
``Range`` is used) or from the Doctrine metadata (via the field's length).
715715

716716
..note::
@@ -721,7 +721,7 @@ the correct values of a number of field options.
721721
If you'd like to change one of the guessed values, you can override it by
722722
passing the option in the options field array::
723723

724-
->add('task', null, array('max_length' =>4))
724+
->add('task', null, array('attr' =>array('maxlength' => 4)))
725725

726726
..index::
727727
single: Forms; Rendering in a template

‎reference/forms/twig_reference.rst‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,11 @@ object:
350350
| ``required``| If ``true``, a ``required`` attribute is added to the field to activate HTML5|
351351
|| validation. Additionally, a ``required`` class is added to the label.|
352352
+------------------------+-------------------------------------------------------------------------------------+
353-
| ``max_length``| Adds a ``maxlength`` HTML attribute to the element.|
353+
| ``max_length``| Adds a ``maxlength`` HTML attribute to the element. (deprecated as of 2.5, to be|
354+
|| removed in 3.0, use ``attr["maxlength"]`` instead)|
354355
+------------------------+-------------------------------------------------------------------------------------+
355-
| ``pattern``| Adds a ``pattern`` HTML attribute to the element.|
356+
| ``pattern``| Adds a ``pattern`` HTML attribute to the element. (deprecated as of 2.5, to be|
357+
|| removed in 3.0, use ``attr["pattern"]`` instead)|
356358
+------------------------+-------------------------------------------------------------------------------------+
357359
| ``label``| The string label that will be rendered.|
358360
+------------------------+-------------------------------------------------------------------------------------+

‎reference/forms/types/email.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The ``email`` field is a text field that is rendered using the HTML5
1010
+-------------+---------------------------------------------------------------------+
1111
| Rendered as| ``input`` ``email`` field (a text box)|
1212
+-------------+---------------------------------------------------------------------+
13-
| Inherited| - `max_length`_|
13+
| Inherited| - `max_length`_(deprecated as of 2.5)|
1414
| options| - `empty_data`_|
1515
|| - `required`_|
1616
|| - `label`_|

‎reference/forms/types/form.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on all types for which ``form`` is the parent type.
2020
|| - `trim`_|
2121
|| - `mapped`_|
2222
|| - `property_path`_|
23-
|| - `max_length`_|
23+
|| - `max_length`_(deprecated as of 2.5)|
2424
|| - `by_reference`_|
2525
|| - `error_bubbling`_|
2626
|| - `inherit_data`_|
@@ -29,7 +29,7 @@ on all types for which ``form`` is the parent type.
2929
|| - `invalid_message_parameters`_|
3030
|| - `extra_fields_message`_|
3131
|| - `post_max_size_message`_|
32-
|| - `pattern`_|
32+
|| - `pattern`_(deprecated as of 2.5)|
3333
+-----------+--------------------------------------------------------------------+
3434
| Inherited| - `block_name`_|
3535
| options| - `disabled`_|
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
.. caution::
2+
3+
The ``max_length`` option has been deprecatedand will be removedin3.0.
4+
Instead, use the ``attr`` option by setting it to an array with a ``maxlength`` key.
5+
16
max_length
27
~~~~~~~~~~
38

49
**type**: ``integer``**default**: ``null``
510

6-
Ifthis option is not null, an attribute ``maxlength`` is added, which
7-
is used by some browsers to limit the amountof textin a field.
11+
Ifthis option is not null, an attribute ``maxlength`` is added, which
12+
is used by some browsers to limit the amountof textin a field.
813

9-
This is just a browser validation, so data must still be validated
14+
This is just a browser validation, so data must still be validated
1015
server-side.
16+

‎reference/forms/types/options/pattern.rst.inc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
.. caution::
2+
3+
The ``pattern`` option has been deprecatedand will be removedin3.0.
4+
Instead, use the ``attr`` option by setting it to an array with a ``pattern`` key.
5+
16
pattern
27
~~~~~~~
38

‎reference/forms/types/password.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The ``password`` field renders an input password text box.
1111
+-------------+------------------------------------------------------------------------+
1212
| Options| - `always_empty`_|
1313
+-------------+------------------------------------------------------------------------+
14-
| Inherited| - `max_length`_|
14+
| Inherited| - `max_length`_(deprecated as of 2.5)|
1515
| options| - `empty_data`_|
1616
|| - `required`_|
1717
|| - `label`_|

‎reference/forms/types/search.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Read about the input search field at `DiveIntoHTML5.info`_
1212
+-------------+----------------------------------------------------------------------+
1313
| Rendered as| ``input search`` field|
1414
+-------------+----------------------------------------------------------------------+
15-
| Inherited| - `max_length`_|
15+
| Inherited| - `max_length`_(deprecated as of 2.5)|
1616
| options| - `empty_data`_|
1717
|| - `required`_|
1818
|| - `label`_|

‎reference/forms/types/text.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The text field represents the most basic input text field.
99
+-------------+--------------------------------------------------------------------+
1010
| Rendered as| ``input`` ``text`` field|
1111
+-------------+--------------------------------------------------------------------+
12-
| Inherited| - `max_length`_|
12+
| Inherited| - `max_length`_(deprecated as of 2.5)|
1313
| options| - `empty_data`_|
1414
|| - `required`_|
1515
|| - `label`_|

‎reference/forms/types/textarea.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Renders a ``textarea`` HTML element.
99
+-------------+------------------------------------------------------------------------+
1010
| Rendered as| ``textarea`` tag|
1111
+-------------+------------------------------------------------------------------------+
12-
| Inherited| - `max_length`_|
12+
| Inherited| - `max_length`_(deprecated as of 2.5)|
1313
| options| - `empty_data`_|
1414
|| - `required`_|
1515
|| - `label`_|

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp