Skip to content

Commit 0a2d679

Browse files
committed
describe the allow_extra_fields form option
1 parent a504acf commit 0a2d679

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
@@ -625,6 +625,20 @@ 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 Extra Fields
629+
~~~~~~~~~~~~~~~~~~~~~
630+
631+
.. versionadded:: 2.6
632+
The ``allow_extra_fields`` option was introduced in Symfony 2.6.
633+
634+
Usually, if you submit extra fields that aren't configured in your form,
635+
you'll get a "This form should not contain extra fields." validation error.
636+
637+
You can silence this validation error by enabling the ``allow_extra_fields``
638+
option on the form::
639+
640+
$form = $this->createForm(new TaskType(), $task, array('allow_extra_fields' => true));
641+
628642
.. index::
629643
single: Forms; Built-in field types
630644

0 commit comments

Comments
 (0)