History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LOOM-160
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Ignacio Coloma
Reporter: Rafael Serrano Fernandez
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Loom

Implement a way to specify method in <l:url>

Created: 24/Mar/09 08:03 PM   Updated: 25/Mar/09 04:02 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5


 Description  « Hide
I'd like to be able to specify the HTTP method in links.

The tricky thing here is that anchors always use GET, but the other verbs (like DELETE) should be POSTed, i.e. some JS is needed to intercept the click on the link.



 All   Comments   Change History      Sort Order:
Ignacio Coloma - 25/Mar/09 04:02 PM
Added a method attribute to UrlTag. Also, if the event has no GET method associated to it and no method has been set at the <l:url>, the first method associated to the event will be used.
For this to work, the user should add his/her own javascript code like this:

$(document.body).observe('click', function(e) {

  var a = e.findElement('a[method]');
  if (a) {
     e.stop();
     new Ajax.Request(a.href, { method: a.getAttribute('method') });
  }

});

Right now, it's such a small amount of code that we are not adding it to our javascript library. We'll wait until some clear use case arises.