Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update "method" description
  • Loading branch information
bicpi committed Jan 23, 2014
commit cecc762018ce808e65bf2bc68764bc2c102aceeb
16 changes: 8 additions & 8 deletions reference/forms/types/options/method.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ method
**type**: ``string`` **default**: ``POST``

This option specifies the HTTP method used to submit the form's data. It's
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its

value is rendered as the ``method`` attribute of the ``form`` element.
value is rendered as the ``method`` attribute of the ``form`` element and to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and is used to perform

perform some consistency checks when evaluating the form after submission.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, maybe (unless there's more going on), we should simply say "is used to decide whether to process the form submission in the handleRequest method after submission"?

Possible values are:

* POST
Expand All @@ -16,11 +17,10 @@ Possible values are:
* DELETE
* PATCH

As PUT, DELETE and PATCH are not nativly supported by most clients, Symfony
simulates them. For more information see
:doc:`/cookbook/routing/method_parameters`.
.. note:

.. note::

Using ``PUT``, ``PATCH`` and ``DELETE`` is only allowed if
:ref:`configuration-framework-http_method_override` is enabled.
If not natively supported by a client, Symfony allows to simulate PUT,
DELETE and PATCH requests by using a POST request instead and passing the
intended "real" method by either using a ``X-HTTP-Method-Override``
request header or by passing it via the special ``_method`` data field.
For more information see :doc:`/cookbook/routing/method_parameters`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof Seems that Symfony also allows to simulate other HTTP methods, but the method form option only allows for setting PUT, PATCH and DELETE, so I hope it's okay to only mention these here. How to enable the _method data field is mentioned in the cookbook, so I omitted this here.

Do you think it's worth adding the request header method using X-HTTP-Method-Override to the cookbook? It does not seem to be documented yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about simply saying something like

When the method is PUT, PATCH, or DELETE, Symfony will automatically render a _method hidden field in your form. This is used "fake" these HTTP methods, as they're not supported on standard browsers. For more information, see (link to here: http://symfony.com/doc/current/book/forms.html#changing-the-action-and-method-of-a-form).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this seems to fit better in this form context. It's fixed.

Having said that, there's no documentation about the usage of the X-HTTP-Method-Override header in the Symfony\Component\HttpFoundation\getRequest() method. Should we add this somewhere?