views:

179

answers:

2

I am trying to figure out why the put/delete methods, in an HTML5 enabled site, is not working with Chrome. From what i've searched for, it sounds like it has been working for some time with Chrome, so with that said i am just looking for a few pointers to narrow down my problem. Perhaps i am implementing the form wrong, perhaps my doctype is wrong, who knows. Any help is appreciated :)

So, the code looks like this:

<!DOCTYPE html> 
<html> 

 <head> 
        <title> 
            some_resource
        </title> 
    </head> 
    <body> 
  <div class="content"> 
  <form method="put" action="/some_resource"> 
   <div> 
    <input id="title" name="title" placeholder="The Resource Title" type="text" value="" autofocus /> 
   </div> 
   <div> 
    <textarea id="body" name="body" placeholder="The Resource Body" required></textarea> 
   </div> 
   <div> 
    <input id="submit" name="submit" type="submit" value="Submit" /> 
   </div> 
   <!-- Resource Settings --> 
   <ul> 
    <li> 
     <input id="listed" name="listed" type="checkbox" value="y" /> 
    </li> 
    <li> 
     <input id="template" name="template" type="text" value="resource.html" /> 
    </li> 
   </ul> 
  </form> 
  </div> 
    </body> 
</html>

Just a basic test for a form. Now i've tried it on the Latest Ubuntu Firefox (3.6.7), Opera (10.60 Internal), and the latest Linux Chrome Beta from Google (5.0.375.99 beta). None of them seem to send the proper put method to the server, when i submit the form. Now, i believe (not from any specific research) that Firefox has yet to support this, and that like a lot of HTML5, it is scheduled for the next version of FF. Opera i do not know about, but i often hear about it keeping pace with Chrome. So.. yea, i'm a bit confused.

When submitting the form, they go to the url: http://localhost:8080/some_resource?title=t&amp;body=b&amp;submit=Submit&amp;template=resource.html. Note that, as expected, POST works just fine.

Now does anyone have any pointers to get the put method working? It could be possible that the beta for Linux simply hasn't been updated to that of the Windows variety (something i assume, is what people were talking about when i saw PUT working for Chrome), but i'm really hoping it is an issue with my implementation.

Do servers have to support PUT/DELETE? (I'm using AppEngine Dev Server currently). I dunno.. hopefully someone has some ideas :)

Thanks to any replies, Lee

Note: Other HTML5 features i've tested so far are working. Eg, in that form you can see autofocus and required attributes. Those are working as intended in Chrome.

Edit1: Just to clarify, i understand support for these is sketchy. As i replied to an answer earlier, i don't care about current support in other browsers. Currently Chrome is what i want to work, and i expect Firefox to work in the upcoming release (i don't know, i just hear them pushing HTML5 a lot), and i have no idea about Opera.

All of this is simply to test and learn the new wonderful world of HTML5 (Web Workers, localStorage, etc) and CSS3. I only care about bleeding edge browsers, which are matching bleeding edge technology :)

+2  A: 

There is no “HTML5”, as a monolithic standard.

Some of it's the same as HTML4. Some of it's ratifying technically-non-standard features that every browser implements and everyone's used for years. Some of it's new extensions that the browser vendors mostly agree on and are in various stages of implementation. Like, for example, autofocus.

But then some of it is spottily-implemented stuff that is likely to change before it's standardised, and some of it's random bonus features that some random people at WHATWG thought would be nice, but which shows no sign of support from the browser authors.

There is less of this latter category than there used to be (early WHATWG drafts were almost as full of architect-astronomy badness as XHTML 2.0), but there's still some, and currently, the extended form submission types (PUT/DELETE methods and some of the non-HTTP actions) are in that category. Every browser currently ignores method="put", falling back to the default attr value get instead.

Maybe one day browsers will implement this. Or maybe it'll be excised from the spec. HTML5 is still a long way from finished. For now, just use POST like everyone else. It's not quite pure RESTfulness, but then that doesn't really get you anything special.

<input ... autofocus /> 

Use HTML or XHTML syntaxes, but don't mix them. autofocus="autofocus" for XHTML5, or for HTML5 lose the self-closing /.

<input id="submit" name="submit" type="submit" value="Submit" /> 

Best avoid naming a button that, to avoid clashes with the form.submit() method. You don't need name on a submit button unless you need to check for a click on one particular button, anyway. (And you don't need to add ids to all your fields either. Unless you need an id for <label for or script targeting, you can leave them out.)

bobince
So what exactly is all this talk about Chrome supporting PUT/DELETE? To put it bluntly, i am using these on personal projects and to learn the new HTML5 features (web workers, etc), so i don't care if i leave other browsers in the dust. I was fully expecting Chrome to work, Firefox to not work at all (until it updates, which brings more HTML5 support), and .. who knows about Opera. IE ofcourse, would require Chrome Frame.I simply want the methods to work as intended.. why the talk about Chrome supporting PUT/DELETE? Did i just misunderstand them?
Lee Olayvar
As far as the closing (/>) and naming (submit) go, that is from a form generator library (Python's WTForms) and i have yet to see how to change the closing tags. As far as the naming of the submit button, that is easily changeable. Again, this is just a test to get PUT working. Everything else does not matter :)
Lee Olayvar
I've not heard such talk myself, but I would suspect that, as @You mentions, it may be to do with `XMLHttpRequest`, which allows sending of these methods except on some older browsers.
bobince
Yea, which is what i am looking into now. Hopefully it can be done in such a way that when Chrome/FF4 start supporting it, i can easily make the switch.
Lee Olayvar
+1  A: 

PUT and DELETE are no longer supported. See HTML5 differences from HTML4 (19 Oct 2010)

darasd
Thanks for the heads up..Any idea how proper REST is supposed to be implemented then?
Lee Olayvar