File tree Expand file tree Collapse file tree 11 files changed +29
-16
lines changed Expand file tree Collapse file tree 11 files changed +29
-16
lines changed Original file line number Diff line number Diff line change @@ -707,8 +707,8 @@ the correct values of a number of field options.
707707 (i.e. is the field ``nullable ``). This is very useful, as your client-side
708708 validation will automatically match your validation rules.
709709
710- * ``max_length ``: If the field is some sort of text field, then the ``max_length ``
711- option can be guessed from the validation constraints (if ``Length `` or
710+ * ``maxlength ``: If the field is some sort of text field, then the ``maxlength ``
711+ option attribute can be guessed from the validation constraints (if ``Length `` or
712712 ``Range `` is used) or from the Doctrine metadata (via the field's length).
713713
714714.. note ::
@@ -719,7 +719,7 @@ the correct values of a number of field options.
719719If you'd like to change one of the guessed values, you can override it by
720720passing the option in the options field array::
721721
722- ->add('task', null, array('max_length ' => 4 ))
722+ ->add('task', null, array('attr ' => array('maxlength' => 4) ))
723723
724724.. index ::
725725 single: Forms; Rendering in a template
Original file line number Diff line number Diff 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+------------------------+-------------------------------------------------------------------------------------+
Original file line number Diff line number Diff 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 `_ |
Original file line number Diff line number Diff 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 `_ |
Original file line number Diff line number Diff line change 1+ .. caution::
2+
3+ The ``max_length`` option has been deprecated and will be removed in 3 .0 .
4+ Instead, use the ``attr`` option by setting it to an array with a ``maxlength`` key.
5+
16max_length
27~~~~~~~~~~
38
49** type** : ``integer`` ** default** : ``null``
510
6- If this option is not null, an attribute ``maxlength`` is added, which
7- is used by some browsers to limit the amount of text in a field.
11+ If this option is not null, an attribute ``maxlength`` is added, which
12+ is used by some browsers to limit the amount of text in 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
1015server- side.
16+
Original file line number Diff line number Diff line change 1+ .. caution::
2+
3+ The ``pattern`` option has been deprecated and will be removed in 3 .0 .
4+ Instead, use the ``attr`` option by setting it to an array with a ``pattern`` key.
5+
16pattern
27~~~~~~~
38
Original file line number Diff line number Diff 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 `_ |
Original file line number Diff line number Diff 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 `_ |
Original file line number Diff line number Diff 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 `_ |
Original file line number Diff line number Diff 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 `_ |
You can’t perform that action at this time.
0 commit comments