Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Tuesday, March 28, 2006

HTML A tag vs. POST

Just an observation. If it is so damned important that GET operations be non-state changing and idempotent (blah blah caching, design of HTTP, firewalls, etc.) ... if it is so damned important that you never change anything expect using POST (and then send a redirect afterwards) ... tell me why the <a> tag does not support a METHOD attribute, the way <form> does. I mean, think back a few years, at all the crazy tags Netscape and Microsoft put into their browsers, and they miss this? Still?

I mean, this hasn't changed in years, and has consistently held web development hostage to the use of JavaScript to keep any non-trivial page from featuring a big old submit button. Apparently, the Powers That Be are afraid that without a big old submit button, we won't realize that hitting the "delete" key is going to delete something.

Sure JavaScript is all pervasive now, and you can force a form to submit using JavaScript ... and the use of Ajax will eventually mean that any non-trivial operation will be coded using XmlHttpRequest (which will do a post). Someday. For users with JavaScript enabled. But I just want to be able to write:

<a href=". . ." method="post">delete this report</a>


MindBridge said...

Just to mention: there is FormLinkRenderer on t-deli that allows you to do things like
<span jwcid="@DirectLink" renderer="ognl:@org.mb.tapestry.link.FormLinkRenderer@RENDERER">
and have your link submitted using POST if you have JavaScript.

But I completely agree -- <a> should have had a method argument, especially with the limitations in URL size.

Geert Bevin said...

I've often wondered about the same thing :-/

Peter said...

Well, it isn't that strange considering that HTML was created for document markup primarily. Right now we are all using it for application front-ends. Hopefully future specifications from W3C will cater for this (you may want to check out XHTML 2 and the Xforms module ready for use by 2010 or so).

Rails actionview helper methods handles a delete button by creating a minimal form around an ordinary "input type=button" element.

Anonymous said...

Nice rant there Howard

r1ch said...

There is a workaround though - you could style a submit button to look like a link, or even hide it completely if you just want to trap keyboard shortcuts.

Truy said...


Yoav said...

Just playing Devil's Advocate for a minute, looking at the opposite point of view: we've done fairly well without this for a while now, so why add it? Wouldn't it be bloat? What does it enable that you absolutely couldn't do otherwise?

(I don't have a particular opinion, just curious to hear your reasoning)

antidevil said...

yoav, read again howard's post! there are so many useless tags, while this little "method" argument would have saved so much time without being "bloat". why use javascript "workarounds" (the real "bloat") while a simple attribute could do the same?

howard, that was a good one!

Jonas said...

Now you could use some CSS-fu to style a button like a link... like this (it doesn't quite work in IE, though):


body {
margin: 0;
padding: 0;
text-align: left;
a, .sublink {
border: 0;
background-color: #fff;
text-decoration: underline;
color: #00f;
font-size: 12px;
font-family: Verdana, Arial, sans-serif;
cursor: pointer;
padding: 0;
margin: 0;
.sublink:active {
padding: 0;
form {
margin: 0;
padding: 0;

<p><a href="test.html">test link</a><br /></p>
<input type="submit" class="sublink" value="test button" />

Anonymous said...


That forms cannot be nested makes using a proper POST damn near impossible on many designs.