8000 [Component][Forms] add missing features introduced in 2.3 by xabbuh · Pull Request #4085 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Component][Forms] add missing features introduced in 2.3 #4085

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

Merged
merged 1 commit into from
Oct 19, 2014
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ possible paths:
from being able to hit the "Refresh" button of their browser and re-post
the data.

.. seealso::

If you need more control over exactly when your form is submitted or which
data is passed to it, you can use the :method:`Symfony\\Component\\Form\\FormInterface::submit`
for this. Read more about it :ref:`in the cookbook <cookbook-form-call-submit-directly>`.

.. index::
single: Forms; Multiple Submit Buttons

Expand Down
43 changes: 43 additions & 0 deletions components/form/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ Behind the scenes, this uses a :class:`Symfony\\Component\\Form\\NativeRequestHa
object to read data off of the correct PHP superglobals (i.e. ``$_POST`` or
``$_GET``) based on the HTTP method configured on the form (POST is default).

.. seealso::

If you need more control over exactly when your form is submitted or which
data is passed to it, you can use the :method:`Symfony\\Component\\Form\\FormInterface::submit`
for this. Read more about it :ref:`in the cookbook <cookbook-form-call-submit-directly>`.

.. sidebar:: Integration with the HttpFoundation Component

If you use the HttpFoundation component, then you should add the
Expand Down Expand Up @@ -489,6 +495,43 @@ as this is, it's not very flexible (yet). Usually, you'll want to render each
form field individually so you can control how the form looks. You'll learn how
to do that in the ":ref:`form-rendering-template`" section.

Changing a Form's Method and Action
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 2.3
The ability to configure the form method and action was introduced in
Symfony 2.3.

By default, a form is submitted to the same URI that rendered t 8000 he form with
an HTTP POST request. This behavior can be changed using the :ref:`form-option-action`
and :ref:`form-option-method` options (the ``method`` option is also used
by ``handleRequest()`` to determine whether a form has been submitted):

.. configuration-block::

.. code-block:: php-standalone

$formBuilder = $formFactory->createBuilder('form', null, array(
'action' => '/search',
'method' => 'GET',
);

// ...

.. code-block:: php-symfony

// ...

public function searchAction()
{
$formBuilder = $this->createFormBuilder('form', null, array(
'action' => '/search',
'method' => 'GET',
));

// ...
}

.. _component-form-intro-handling-submission:

Handling Form Submissions
Expand Down
2 changes: 2 additions & 0 deletions cookbook/form/direct_submit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ submissions::

To see more about this method, read :ref:`book-form-handling-form-submissions`.

.. _cookbook-form-call-submit-directly:

Calling Form::submit() manually
-------------------------------

Expand Down
4 changes: 4 additions & 0 deletions reference/forms/types/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ on all types for which ``form`` is the parent type.
Field Options
-------------

.. _form-option-action:

.. include:: /reference/forms/types/options/action.rst.inc

.. include:: /reference/forms/types/options/by_reference.rst.inc
Expand Down Expand Up @@ -96,6 +98,8 @@ The actual default value of this option depends on other field options:

.. include:: /reference/forms/types/options/max_length.rst.inc

.. _form-option-method:

.. include:: /reference/forms/types/options/method.rst.inc

.. _reference-form-option-pattern:
Expand Down
0