Should PUT and DELETE be used in forms?
Assuming my web application has full support of PUT and DELETE on the server side, should I make use of them?
Basically my question is how many browsers support this:
<form method="PUT">
or
<form method="DELETE">
Is there any benefits to using these two HTTP Methods other than being REST-compliant? (assuming the replacement for these two methods is the commonly used POST)
Solution 1:
Your question involves two closely related but separate standards, HTTP and HTML. The PUT and DELETE methods are part of HTTP. In HTTP they have obvious use in RESTful interfaces, and other services which build on HTTP such as Webdav.
HTML up to version 4 only defines the use of POST and GET for forms. HTML5 at this time appears as though it may support the further methods. [note, support is not included in the current w3 draft]
Any current browser support (I'm not directly aware of any) will be very limited and only really useful as an experiment at the bleeding edge.
Solution 2:
GET, POST, PUT and DELETE (there are others) are a part of the HTTP standard, but you are limited to GET and POST in HTML forms at this time.
As Andrew mentioned, you can use PUT and DELETE in AJAX requests; however, this only works in some browsers (see http://api.jquery.com/jQuery.ajax/).
Solution 3:
No, GET
& POST
are the only valid HTTP method values for the method
attribute. See the HTML spec for more information.
I believe you can use them in AJAX requests, though.