{"id":1398,"date":"2012-06-19T07:55:01","date_gmt":"2012-06-18T23:55:01","guid":{"rendered":"http:\/\/blog.lolyco.com\/sean\/?p=1398"},"modified":"2012-06-22T03:32:03","modified_gmt":"2012-06-21T19:32:03","slug":"cannot-submit-html-form-mobile-browser-nokia-s40-response-unknown","status":"publish","type":"post","link":"https:\/\/blog.lolyco.com\/sean\/2012\/06\/19\/cannot-submit-html-form-mobile-browser-nokia-s40-response-unknown\/","title":{"rendered":"Cannot submit HTML form in mobile browser (Nokia\/S40 &#8220;Response unknown&#8221;)"},"content":{"rendered":"<p>A quick note, because this stole several hours of my life. I knocked up a little web application with a trivial web form which was CSS, cookie and javascript-free in the expectation that it would work even on elderly mobile phones, so long as they had a browser. It was properly &#8220;Web1.0&#8221; and worked a treat in my usual selection of browsers. <a href=\"http:\/\/validator.w3.org\/\">Validator.w3.org<\/a> said it was valid HTML. The page is a form with one or two (visible inputs) with hidden inputs set by the server-side code to maintain some state across several requests.<\/p>\n<p>I copied the application up to a public host, ran it there and opened it up with my trusty <a href=\"http:\/\/en.wikipedia.org\/wiki\/Nokia_6500_classic\">Nokia 6500 Classic<\/a>. It showed the first page in the series of 4, but then the submit input button &#8211; which should have submitted the form by post &#8211; didn&#8217;t work. The browser popped up an alert saying &#8220;<strong>Response unknown<\/strong>&#8221; (on the Nokia, the other phones I tried just ignored me). There were plenty of pages to read which seemed similar, but none which helped me find the answer. I ended up copy-pasting the dynamically generated page source into a file on my host and repeatedly edited and reloaded it on my phone until I found the problem.<\/p>\n<p>It was my fault: I&#8217;m too used to modern browsers &#8216;helping&#8217; me by guessing what I intended to happen when I wrote my bad page source. I had acquired a <a href=\"http:\/\/stackoverflow.com\/questions\/1131781\/is-it-a-good-practice-to-use-an-empty-url-for-a-html-forms-action-attribute-a\">religious belief that the form element didn&#8217;t need an action attribute<\/a> and omitting it would cause the form to be submitted to the URL from which it was requested. The old phones I tried (the Nokia and a <a href=\"http:\/\/www.youtube.com\/watch?v=_B_GYf2LZlE\">throwing Samsung<\/a>) <strong>would not submit a form without an action attribute<\/strong>. Their browsers were presumably designed in line with the <a href=\"http:\/\/www.w3.org\/TR\/html401\/interact\/forms.html#h-17.3\">HTML4 spec, which says that action is a REQUIRED attribute<\/a>. <a href=\"http:\/\/dev.w3.org\/html5\/spec\/single-page.html#form-submission-0\">HTML5 doesn&#8217;t say whether the action attribute is required<\/a> or not, saying instead<\/p>\n<blockquote><p>The <dfn id=\"attr-fs-action\" title=\"attr-fs-action\"><code>action<\/code><\/dfn> and <dfn id=\"attr-fs-formaction\" title=\"attr-fs-formaction\"><code>formaction<\/code><\/dfn> content attributes, if specified, must have a value<\/p><\/blockquote>\n<p>(and then a couple of lines later, they emphasise the wrong word, &#8220;it&#8221; instead of &#8220;if&#8221;, just to test if you&#8217;re reading carefully)<\/p>\n<p>The fix was straightforward: I just copied the request-URI into an action attribute for the form element and the pages now work a treat on the two old phones I have here. I hope that&#8217;s useful to you if you&#8217;re developing apps for yesterday&#8217;s User-Agents!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A quick note, because this stole several hours of my life. I knocked up a little web application with a trivial web form which was CSS, cookie and javascript-free in the expectation that it would work even on elderly mobile phones, so long as they had a browser. It was properly &#8220;Web1.0&#8221; and worked a [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,64],"tags":[82,65,105,57],"class_list":["post-1398","post","type-post","status-publish","format-standard","hentry","category-software","category-useful","tag-html","tag-mobile","tag-software","tag-web"],"_links":{"self":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/1398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/comments?post=1398"}],"version-history":[{"count":4,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/1398\/revisions"}],"predecessor-version":[{"id":1401,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/1398\/revisions\/1401"}],"wp:attachment":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/media?parent=1398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/categories?post=1398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/tags?post=1398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}