[whatwg] A thought: <a href="..." method="post">

Ian Hickson ian at hixie.ch
Fri May 6 21:35:35 PDT 2005

On Fri, 6 May 2005, Ian Bicking wrote:
> I'd basically agree.  Which perhaps makes the argument stronger -- I 
> agree, and yet when I'm actually writing an application I frequently do 
> this anyway ;)  This is such a common practice, and at least 
> method="post" offers a path to get people to move in the right 
> direction.

That's a good point. I've added your suggestion to the list of things for 
me to look at when I go through the "semantics" stuff again (i.e. element 
definitions) in the Web Apps 1 (aka "HTML5") spec.

> It's not 100% clear to me how you'd do the equivalent with <button>.

If backwards compatibility was not an issue:

   <button name="delete" value="10" action="form" method="post">delete this</button>

If it was:

   <form action="form" method="post">
     <button name="delete" value="10">delete this</button>

Note that using a link for this is somewhat of a hack:

   <a href="form?delete=10" method="post">delete this</a>

We're making the submission URI a magic string, which is suboptimal at 
best. I'd feel more comfortable with something like:

   <a href="form" body="delete=10" method="post">delete this</a>

...but of course that wouldn't be backwards compatible.

> But one major reasons for buttons not being used (besides currently 
> requiring Javascript) is that they don't look very nice in long lists, 
> so control over appearance is important.

How does this work in native UIs? People don't use links there. Why is 
this different?

> > But having said that, a lot of people have asked for this kind of 
> > thing. Should we give up on our ideals in this particular case and 
> > just say that the "method" attribute can change the <a> from being a 
> > simple hyperlink to being part of a submission UI?
> I must admit I don't know what you mean by "submission UI".  If you 
> mean, act like a submit button for the containing form, then no, people 
> use anchors specifically to avoid that.  Or do you mean something else?

That's exactly what I meant. People shouldn't avoid it -- something that 
looks like a link should be a fricking link. I should see the URI in the 
status bar and be able to copy it and paste it and open multiple windows 
and so forth and it should all just be idempotent.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list