views:

97

answers:

3

A form in my app has the following:

<form  action="/faculty/update/agxzdGFuZHJld3NqaHNyDQsSB0ZhY3VsdHkYBww" method="PUT" accept-charset="utf-8">

However, upon submission the request is treated as a GET and is handled by def get() and not def put(). Any help would be appreciated!

Edit: Thanks for the responses. If I can't use method="PUT" what is the best way of directed the form the the put() method within my handler class? Should I add another handler within main.py?

+1  A: 

I believe GET and POST are the only valid values on a FORM method attribute.

mythz
+5  A: 

HTML v4 and XHTML v1 only support the GET and POST request methods within HTML forms.

On the other hand the GET, POST, PUT and DELETE methods are supported via XMLHttpRequest in all modern browsers.

Related Stack Overflow post:


EDIT:

Further to your update, I think your only options would be:

  • Use the POST method in your form and handle it through the post() handler.
  • Use AJAX (XMLHttpRequest) to post your form with JavaScript, using the PUT method.
  • Use HTML5, but this will not work in Internet Explorer.
Daniel Vassallo
+2  A: 

Browsers only do GET & POST methods. See if your app's platform can simulate PUT methods via a "method" parameter.

marklai