This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Score one for ugly URLs
Feed Title: Avi Bryant
Feed URL: http://smallthought.com/avi/?feed=rss2
Feed Description: HREF Considered Harmful
Through Patrick Logan, I came across this description of a pattern for avoiding making users "click submit only once" in a web application:
Roughly, it looks like this:
1. The browser requests the Web page that contains the final order form (with the 'Submit' button in it),
2. The server sends back a page whose form has a unique 'action' link; e.g., "http://shop.example.com/orders/1234",
3. The user submits the form, which is POSTed to the 'action' link, in turn submitting the order.
4. The server sends back a page that says that the order has been successfully submitted.
Yup. That sounds an awful lot like Seaside, where every link and form action has exactly that kind of unique URL. In Seaside, this particular pattern would be expressed by putting the final order form (in fact, probably the entire order process) inside an isolate: block, with the confirmation outside of it. As soon as you exit the isolate block, any urls generated inside of it become invalid, so you can't submit to them a second time. But until then you can backtrack and resubmit all you like. The code could look like this:
People often complain about having "meaningless" numbers in the URLs, but they enable a level of abstraction over HTTP that wouldn't otherwise be possible. Getting rid of "click submit only once" is just one of the things that makes easy.