User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0b6) Gecko/20100101 Firefox/4.0b6 Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0b6) Gecko/20100101 Firefox/4.0b6 (I encountered this bug in Firefox, but submitted it under the General category since it relates to 'handling of web content'.) Firefox lets you submit an HTML form by putting focus on it (for example, putting the cursor in a textfield) and pressing Enter. This works even if the HTML code for the form is only partially downloaded, and even if no submit button has been downloaded yet. That can lead to surprising results when a user presses Enter and submits a form missing some elements. Typically, they will get an error page from the server, when it would have been more helpful to wait for the entire form to download before allowing submission. Reproducible: Always Steps to Reproduce: 1. Create a web page with the following content, with a pause at the point indicated. (I used a simple CGI script.) <html> <body> <form method="get" action="/cgi-bin/test_page" enctype="multipart/form-data"> <input type="text" name="y" value="y" /> <!-- Here print the output so far and pause for 10 seconds. --> <input type="text" name="z" value="z" /> <input type="submit" name=".submit" /> </form> </body> </html> 2. Open this page in Firefox. The first textfield 'y' is displayed. 3. Before the rest of the page is shown, click in the 'y' textfield and press Enter. Actual Results: The form is submitted with parameters 'y=y'. Expected Results: The entire form should have been downloaded first, and then submitted with all the form parameters, in other words 'y=y&z=z'. Alternatively, the Enter keypress could be ignored if typed before the whole form has been shown. Arguably, it's not the end of the form that should be waited for, but the Submit button. If the website has included a Submit button in the HTML printed so far, that's an indication that the user is expected to press it. So an equivalent action on hitting the Enter key would be fine. I couldn't find any explicit rule in the HTML 4.01 specification about whether the user agent should wait to see the whole form before submitting. Looking at the behaviour of other browsers, IE and Chrome share Firefox's behaviour of sending an incomplete form. Safari appears to avoid the problem by not displaying a partially downloaded <form> element at all. Nonetheless, I believe that a better user experience and more useful behaviour is to wait for the whole form or a submit button before allowing submission.
> If the website has included a Submit button in the HTML printed so far What if it hasn't included such a button at all?
>What if it hasn't included such a button at all? In that case, I would suggest, wait for the closing </form> before considering the form ready to submit.
That might not be present either. And in particular, in HTML5 elements can explicitly declare which form they belong to, so an element for a given form can appear anywhere in the document: before the form, inside the form, after the form, whatever.
>And in particular, in HTML5 elements can >explicitly declare which form they belong to, so an element for a given form >can appear anywhere in the document Right. So if no submit button is seen, wait for the whole document to download before allowing form submission. That doesn't change the essential point here, which is that it is unhelpful to submit a form when even the submit button has not been seen yet, let alone the rest of the document. To do so is effectively doing a partial form submission, which doesn't appear to be what the standards intend and unlikely to be what the user wants.
That doesn't seem reasonable, since in practice many documents on the web never finish downloading (e.g. because the JS code writes them out and never calls document.close()). I strongly suggest taking this up in firstname.lastname@example.org. I agree that there's a problem here; it's just not clear to me how to fix it without breaking some existing sites.
Submitted to the W3C bug tracker: <http://www.w3.org/Bugs/Public/show_bug.cgi?id=11347>
The people from the HTML WG have clarified this. Apparently, the semantics for a partially downloaded form follow the same rules as any partial document: just treat it as if it were the complete page. This implies that a partially downloaded form can be submitted just as well as a finished one, meaning that Firefox's current behaviour complies with the standard (and
Sorry, submitted the form with incomplete content, ironically enough... The people from the HTML WG have clarified this. Apparently, the semantics for a partially downloaded form follow the same rules as any partial document: just treat it as if it were the complete page. This implies that a partially downloaded form can be submitted just as well as a finished one, meaning that Firefox's current behaviour complies with the standard (and incidentally Safari, which stops the user from submitting an incomplete form, is non-compliant). In my personal view the behaviour is unhelpful to the user and it would be much friendlier to wait for the whole form to be downloaded before trying to submit it, but I am not a standards body.
Marking WONTFIX to follow W3C decision. Feel free to reopen if anything new happen. FTR, I agree with Hixie and I don't think it is useful to check that the page is completely downloaded before allowing form submission. Even more because you can have pages which are constantly updated.
>Marking WONTFIX to follow W3C decision. The final word from the W3C bug linked to is "it is up to the browser". So if Firefox wished to implement some more user-friendly behaviour here, it would not be against the standard to do so.