Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:2.3fromxabbuh:issue-2969
Oct 19, 2014
Merged
Show file tree
Hide file tree
Changes fromall 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 deletionsbook/forms.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionscomponents/form/introduction.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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 the 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 deletionscookbook/form/direct_submit.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsreference/forms/types/form.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand 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

[8]ページ先頭

©2009-2025 Movatter.jp