W3C home > Mailing lists > Public > public-html@w3.org > December 2007

Re: Evaluating HTTP Methods in the Spec

From: Adam van den Hoven <adam.vandenhoven@gmail.com>
Date: Wed, 19 Dec 2007 09:30:30 -0800
Cc: "public-html@w3.org Tracking WG" <public-html@w3.org>
Message-Id: <2271D78B-A890-41C4-9A4F-91E9514405D0@gmail.com>
To: Julian Reschke <julian.reschke@gmx.de>


> On 19-Dec-07, at 2:08 AM, Julian Reschke wrote:
>
> Adam van den Hoven wrote:
>>>
>>> On 18-Dec-07, at 8:46 AM, Julian Reschke wrote:
>>>
>>> Adam van den Hoven wrote:
>>>> ...
>>>> 1) Allow a METHOD attribute on any element that allows an HREF or  
>>>> ACTION attribute (namely 'a' and 'form' tags)
>>>
>>> No, please do not overload <a>. (You already expected that  
>>> feedback :-), so I'll not spend time on explaining it here again).
>> I'm not overloading <a>, or at least unnecessarily so. since I'd  
>> like to see the explaination, a URL for the conversation would be  
>> appreciated.
>
> Yes, you do.
>
> Tons of code out there works under the assumption that a/@href  
> points to a resource that should be navigated to by getting its  
> representation, replacing the current document. All this code will  
> do the wrong thing (== something else than what you want it to do),  
> when getting something like
>
> <a href="..." method="DELETE"/>
>
> Besides that, there's a distinction between hyperlinks and buttons  
> for a reason, and the fact that with some effort you *can* style a  
> button as a hyperlink doesn't mean it's a good idea (indeed it's a  
> very bad idea), and there's no reason to make it easier than it is  
> today.

Regardless of what tags you use, user centred design would suggest  
that you style the element in such a way that it clearly indicates its  
purpose. Without a doubt, anything that is simply underlined (or looks  
like a navigation element) should only ever GET a resource. However, I  
see no reason why you couldn't use <a href="..."  
method="DELETE">Delete</a> and some nice CSS to make it appropriately  
styled. It wouldn't change the semantics of the tag as the semantics  
are defined by the method attribute. Secondly, the response from the  
DELETE would typically be a redirect that would have the browser  
reload the page that the original link was on (obviously updated for  
the lack of a new resource).

Here is what I want to write:

<table>
     <caption>Current Widgets</caption>
     <thead>
         <tr>
             <th>Name</th>
             <th>SKU</th>
             <th>Description</th>
             <th>Price</th>
             <th></th>
         </tr>
     </thead>
     <tbody>
         <tr>
             <td><input form="widgetform1" name="name" value="Widget  
1" /></td>
             <td><input form="widgetform1" name="sku"  
value="654065460" /></td>
             <td><textarea form="widgetform1" name="description">Some  
Description</textarea></td>
             <td><input form="widgetform1" name="price" value="654.15"/ 
 ></td>
             <td>
                 <form id="widgeform1" method="PUT" action="/widgets/1">
                     <button type="submit">Save Changes</button>
                 </form>
                 <a href="/widgets/1" method="DELETE"/>
             </td>
         </tr>
     </tbody>
</table>

But  because my anchor can only do GETs, I'm stuck with
<table>
     <caption>Current Widgets</caption>
     <thead>
         <tr>
             <th>Name</th>
             <th>SKU</th>
             <th>Description</th>
             <th>Price</th>
             <th></th>
         </tr>
     </thead>
     <tbody>
         <tr>
             <td><input form="widgetform1" name="name" value="Widget  
1" /></td>
             <td><input form="widgetform1" name="sku"  
value="654065460" /></td>
             <td><textarea form="widgetform1" name="description">Some  
Description</textarea></td>
             <td><input form="widgetform1" name="price" value="654.15"/ 
 ></td>
             <td>
                 <form id="widgeform1" method="PUT" action="/widgets/1">
                     <button type="submit">Save Changes</button>
                 </form>
                 <form id="widgeform2" method="Delete" action="/ 
widgets/1">
                     <button type="submit">Delete</button>
                 </form>
             </td>
         </tr>
     </tbody>
</table>

The extra form is meaningless. You might as well have <form action="/ 
index.html" method="GET"><input type='submit' value="Go Here" /></ 
form> instead of an anchor tag.
Received on Wednesday, 19 December 2007 17:30:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:11 GMT