Skip to content

Commit

Permalink
describe the allow_extra_fields form option
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed May 23, 2015
1 parent a504acf commit 0a2d679
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,20 @@ Now the form will skip your validation constraints. It will still validate
basic integrity constraints, such as checking whether an uploaded file was too
large or whether you tried to submit text in a number field.

Handling Extra Fields
~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 2.6
The ``allow_extra_fields`` option was introduced in Symfony 2.6.

Usually, if you submit extra fields that aren't configured in your form,
you'll get a "This form should not contain extra fields." validation error.

You can silence this validation error by enabling the ``allow_extra_fields``
option on the form::

$form = $this->createForm(new TaskType(), $task, array('allow_extra_fields' => true));

.. index::
single: Forms; Built-in field types

Expand Down

0 comments on commit 0a2d679

Please sign in to comment.