Closed Bug 647231 Opened 14 years ago Closed 14 years ago

FormData(form) created in an submit event fired by a button click does not include the content of the button

Categories

(Core :: DOM: Core & HTML, defect)

2.0 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: chambart, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20110322 Firefox/4.0 Iceweasel/4.0 Build Identifier: iceweasel 4.0 In this example: <html><body> <form> <button name="toto" value="tata">some button</button> <input type="text" name="a" value="a" /> </form> <script> var form = window.document.forms[0]; function truc () { var fd = FormData(form); var xhr = new XMLHttpRequest(); xhr.open("POST", "http://example.com/truc"); xhr.send(fd); return(false); } form.onsubmit = truc; </script> </body></html> When clicking on the button, the fd value created with FormData should contain the value of the button because the submit event was triggered by a button click. see: http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#constructing-form-data-set and http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#formdata It is the behaviour of chromium 10 Note that it is almost impossible to test wether this functionnality works correctly before using it, since it is impossible to verify the contents of a formData. Reproducible: Always Steps to Reproduce: 1. open a file containing the example in detail in firefox 4.0 with firebug 2. click on the button 3. look at the contents of the request in firebug: in the multipart post data, there isn't the contents of the button. Actual Results: the contents of the post request is something like -----------------------------821132791154272111946641278 Content-Disposition: form-data; name="a" a -----------------------------821132791154272111946641278-- Expected Results: should be -----------------------------821132791154272111946641278 Content-Disposition: form-data; name="a" a -----------------------------821132791154272111946641278 Content-Disposition: form-data; name="toto" tata -----------------------------821132791154272111946641278--
Version: unspecified → 2.0 Branch
As far as I can tell Chrome's behavior is just wrong. The "submitter" in the HTML5 spec is not a static property of the form, but of the submission process. That said, the spec is definitely unclear. In particular, XHR is referring to an algorithm that is not standalone in this case. Anne, that needs to be addressed.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
Should I just say that no control is the submitter when "invoking" the algorithm? Was this raised on the list?
Probably, and I have no idea, in that order.
I could not find this on the list, but I got it fixed in HTML: http://html5.org/r/6403
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.