- From: Arthur Clifford <artclifford@me.com>
- Date: Tue, 11 Mar 2014 21:32:47 -0700
- To: "public-html-comments@w3.org" <public-html-comments@w3.org>
I discovered something today that I find a bit disturbing. Here is a very simple html doc: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script> function handleClick() { window.location = 'pudding.html'; } </script> </head> <body> <form > <button >First Button</button> <button onClick='handleClick()'>Second Button</button> </form> </body> </html> Basically I added a form and two buttons to a generated html file. The universal behavior on all 'modern' browsers is a page reload when you click either button and when you click the one with a click handler nothing happens. This is happening because a form's default action is to post to the current page and because all button elements in a form are submit buttons unless given a type of button. I can only assume this is due to some really bad idea someone had at the w3c to suggest that: 1) a form with NO ACTION should .... take SOME ACTION. 2) a button in a form with NO TYPE should be of type SUBIT I find this disturbing because I want to live in a world where: 1) if I don't specify a form should do something it should not take its own initiative to get what I 'really' want completely wrong. 2) if I don't specify a type on something called a BUTTON I should rest comfortably in the knowledge that it is of type ... well ... BUTTON. Instead i seem to have awoken in a parallel universe where a form with no action has an action of '?' and a buttons aren't really buttons. For all the whining I've seen here and other places about semantic web: <form> <button></button> </form> In no way suggests semantically that what is described is anything other than a form and a button. It does not imply that the button is a submit button. It does not say the form performs any action. <form action='?'> <button type='submit'></button> </form> Says this is a form that submits to the current page when you click the button that is of type submit. Having to write: <form> <button type='button'></button> </form> Is semantically redundant a waste of bandwidth, especially if I have multiple buttons on a complex/interesting form. Having to do something like: <form action='javascript:void(0)"> <button type='button></button> </form> Would not only be stupid it would be epically stupid as way of 'semantically' describing a form that does nothing and a button that is just a button and not a submit button. If you really want a button that by default submits a form how about, oh i don't know, an element called .... SubmitButton! <form> <SubmitButton></SubmitButton> </form> Or <form action='?'> <submit></submit> </form> That should satisfy semantic markup, provide simple utility and not be stupid. I doubt any action will be taken on this, but really I needed a place to rant on behalf of everybody wondering how any of this actually makes any sense. Art C.
Received on Wednesday, 12 March 2014 10:36:57 UTC