1

Is it possible to fire off an http DELETE using an html form? I have an app that requires an http delete but when I try posting to it with my form, it tells me the method is not allowed and to try DELETE. Here is my form code:

<form method='delete' action='/groups/dissolve/$org_ID' />
<input class='btn btn-danger' type='submit' value='close group forever' style='font-size:82.5%' />
</form>

I am following instructions I found on this site: http://amundsen.com/examples/put-delete-forms/

When I use the REST client plugin for FireFox and send an http delete, it works. Does not work from the form I wrote above. Help?

Thanks

Progger
  • 2,266
  • 4
  • 27
  • 51
  • The link you provide in the question is a proposal with examples. They show how it would work if the proposal were implemented. It is not part of any spec yet. – John Watts Aug 08 '12 at 21:38

2 Answers2

1

Nope - you cannot code HTTP verbs like "DELETE" from an HTML 4.x or XHTML form:

Community
  • 1
  • 1
paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • Thanks @paulsm4 for your quick response. You state that is cannot be done with HTML 4.x or XHTML. What about HTML 5? – Progger Aug 08 '12 at 21:34
  • @Progger: yes, I believe HTML 5 forms will support DELETE: http://www.devx.com/webdev/Article/42827/1954 – paulsm4 Aug 08 '12 at 21:56
1

(I assume that even thought it isn't possible in straight HTML that you still want to get it done.)

You can do it with a bit of Jquery:

How to send a PUT/DELETE request in jQuery?

Override the submit button's behavior and call your own code to process the delete.

Community
  • 1
  • 1
Mike Johnston
  • 348
  • 1
  • 9