8000 [book][form] Adding note on how to access the raw form data from a te… · web-dev/symfony-docs@8892b24 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8892b24

Browse files
committed
[book][form] Adding note on how to access the raw form data from a template - closes symfony#385
1 parent 8c97795 commit 8892b24

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

book/forms.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,20 @@ the label, errors and HTML form widget of each field inside a ``div`` tag
598598
by default. In the :ref:`form-theming` section, you'll learn how the ``form_row``
599599
output can be customized on many different levels.
600600

601+
.. tip::
602+
603+
You can access the current data of your form via ``form.vars.value``:
604+
605+
.. configuration-block::
606+
607+
.. code-block:: jinja
608+
609+
{{ form.vars.value.task }}
610+
611+
.. code-block:: html+php
612+
613+
<?php echo $view['form']->get('value')->getTask() ?>
614+
601615
.. index::
602616
single: Forms; Rendering each field by hand
603617

0 commit comments

Comments
 (0)
0