Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form]Some form fixes #1479

Merged
merged 2 commits into from Jul 3, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions book/forms.rst
Expand Up @@ -390,7 +390,7 @@ you'll need to specify which validation group(s) your form should use::
; ;


If you're creating :ref:`form classes<book-form-creating-form-classes>` (a If you're creating :ref:`form classes<book-form-creating-form-classes>` (a
good practice), then you'll need to add the following to the ``getDefaultOptions()`` good practice), then you'll need to add the following to the ``setDefaultOptions()``
method:: method::


use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;
Expand Down 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 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:: method to specify the option::


namespace Acme\TaskBundle\Form\Type; 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`_ set) the ``multiple`` attribute on the ``select`` field. See `Creating a Template for the Field`_
for more details. 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 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. others that you need here.


.. tip:: .. tip::


If you're creating a field that consists of many fields, then be sure 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``. 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 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 The ``getName()`` method returns an identifier which should be unique in
your application. This is used in various places, such as when customizing 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. 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. of ``LocationType`` and directly start using it in the two original form types.


Look at the result:: Look at the result::
Expand Down