Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a9ec209

Browse files
committed
Merge branch '2.0' into 2.1
2 parents c488fcc + 0b0164f commit a9ec209

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

reference/forms/types/repeated.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,44 @@ the actual type of the two underlying fields. The ``options`` option is passed
5252
to each of those individual fields, meaning - in this example - any option
5353
supported by the ``password`` type can be passed in this array.
5454

55+
Rendering
56+
~~~~~~~~~
57+
58+
The repeated field type is actually two underlying fields, which you can
59+
render all at once, or individually. To render all at once, use something
60+
like:
61+
62+
.. configuration-block::
63+
64+
.. code-block:: jinja
65+
66+
{{ form_row(form.password) }}
67+
68+
.. code-block:: php
69+
70+
<?php echo $view['form']->row($form['password']) ?>
71+
72+
To render each field individually, use something like this:
73+
74+
.. configuration-block::
75+
76+
.. code-block:: jinja
77+
78+
{{ form_errors(form.password) }}
79+
{{ form_row(form.password.first) }}
80+
{{ form_row(form.password.second) }}
81+
82+
.. code-block:: php
83+
84+
<?php echo $view['form']->errors($form['password']) ?>
85+
<?php echo $view['form']->row($form['password']['first']) ?>
86+
<?php echo $view['form']->row($form['password']['second']) ?>
87+
88+
.. note::
89+
90+
The sub-field names are ``first`` and ``second`` by default, but can
91+
be controlled via the `first_name`_ and `second_name`_ options.
92+
5593
Validation
5694
~~~~~~~~~~
5795

0 commit comments

Comments
 (0)