Skip to content

Commit

Permalink
Merge pull request #1479 from nomack84/form_fixes
Browse files Browse the repository at this point in the history
[Form]Some form fixes
  • Loading branch information
weaverryan committed Jul 3, 2012
2 parents d590450 + 68da45b commit cb79c95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion book/forms.rst
Expand Up @@ -1550,7 +1550,7 @@ but here's a short example::
;

Now, when you call `$form->bindRequest($request)`, the constraints setup here are run
against your form's data. If you're using a form class, override the ``getDefaultOptions``
against your form's data. If you're using a form class, override the ``setDefaultOptions()``
method to specify the option::

namespace Acme\TaskBundle\Form\Type;
Expand Down
6 changes: 3 additions & 3 deletions cookbook/form/create_custom_field_type.rst
Expand Up @@ -70,17 +70,17 @@ important:
set) the ``multiple`` attribute on the ``select`` field. See `Creating a Template for the Field`_
for more details.

* ``getDefaultOptions()`` - This defines options for your form type that
* ``setDefaultOptions()`` - This defines options for your form type that
can be used in ``buildForm()`` and ``buildView()``. There are a lot of
options common to all fields (see `FieldType`_), but you can create any
options common to all fields (see `FormType`_), but you can create any
others that you need here.

.. tip::

If you're creating a field that consists of many fields, then be sure
to set your "parent" type as ``form`` or something that extends ``form``.
Also, if you need to modify the "view" of any of your child types from
your parent type, use the ``buildViewBottomUp()`` method.
your parent type, use the ``finishView()`` method.

The ``getName()`` method returns an identifier which should be unique in
your application. This is used in various places, such as when customizing
Expand Down
2 changes: 1 addition & 1 deletion cookbook/form/use_virtuals_forms.rst
Expand Up @@ -113,7 +113,7 @@ But we absolutely want to have a dedicated form type to deal with location (reme

The ``virtual`` form field option is the solution.

We can set the option ``'virtual' => true`` in the ``getDefaultOptions`` method
We can set the option ``'virtual' => true`` in the ``setDefaultOptions()`` method
of ``LocationType`` and directly start using it in the two original form types.

Look at the result::
Expand Down

0 comments on commit cb79c95

Please sign in to comment.