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

Appearance settings

Commit e1042c3

Browse filesBrowse files
committed
describe the allow_extra_fields form option
1 parent a504acf commit e1042c3
Copy full SHA for e1042c3

File tree

Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-0
lines changed

‎book/forms.rst

Copy file name to clipboardExpand all lines: book/forms.rst
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,21 @@ Now the form will skip your validation constraints. It will still validate
625625
basic integrity constraints, such as checking whether an uploaded file was too
626626
large or whether you tried to submit text in a number field.
627627

628+
Handling Additional Fields
629+
~~~~~~~~~~~~~~~~~~~~~~~~~~
630+
631+
.. versionadded:: 2.6
632+
The ``allow_extra_fields`` option was introduced in Symfony 2.6.
633+
634+
Usually, the Form component will complain when your submitted form contains
635+
fields that were not configured before (for example, when fields are added
636+
using JavaScript or when a page contains several forms without a name).
637+
638+
You can silence this error message by enabling the ``allow_extra_fields``
639+
option on the form::
640+
641+
$form = $this->createForm(new TaskType(), $task, array('allow_extra_fields' => true));
642+
628643
.. index::
629644
single: Forms; Built-in field types
630645

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.