@@ -78,6 +78,12 @@ Behind the scenes, this uses a :class:`Symfony\\Component\\Form\\NativeRequestHa
7878object to read data off of the correct PHP superglobals (i.e. ``$_POST `` or
7979``$_GET ``) based on the HTTP method configured on the form (POST is default).
8080
81+ .. seealso ::
82+
83+ If you need more control over exactly when your form is submitted or which
84+ data is passed to it, you can use the :method: `Symfony\\ Component\\ Form\\ FormInterface::submit `
85+ for this. Read more about it :ref: `in the cookbook <cookbook-form-call-submit-directly >`.
86+
8187.. sidebar :: Integration with the HttpFoundation Component
8288
8389 If you use the HttpFoundation component, then you should add the
@@ -489,6 +495,43 @@ as this is, it's not very flexible (yet). Usually, you'll want to render each
489495form field individually so you can control how the form looks. You'll learn how
490496to do that in the ":ref: `form-rendering-template `" section.
491497
498+ Changing a Form's Method and Action
499+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
500+
501+ .. versionadded :: 2.3
502+ The ability to configure the form method and action was introduced in
503+ Symfony 2.3.
504+
505+ By default, a form is submitted to the same URI that rendered the form with
506+ an HTTP POST request. This behavior can be changed using the :ref: `form-option-action `
507+ and :ref: `form-option-method ` options (the ``method `` option is also used
508+ by ``handleRequest() `` to determine whether a form has been submitted):
509+
510+ .. configuration-block ::
511+
512+ .. code-block :: php-standalone
513+
514+ $formBuilder = $formFactory->createBuilder('form', null, array(
515+ 'action' => '/search',
516+ 'method' => 'GET',
517+ );
518+
519+ // ...
520+
521+ .. code-block :: php-symfony
522+
523+ // ...
524+
525+ public function searchAction()
526+ {
527+ $formBuilder = $this->createFormBuilder('form', null, array(
528+ 'action' => '/search',
529+ 'method' => 'GET',
530+ ));
531+
532+ // ...
533+ }
534+
492535 .. _component-form-intro-handling-submission :
493536
494537Handling Form Submissions
0 commit comments