Closed
Bug 324377
Opened 19 years ago
Closed 19 years ago
[FIX] Submitting file control that's just been added to the DOM fails
Categories
(Core :: Layout: Form Controls, defect, P3)
Core
Layout: Form Controls
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: arpad, Assigned: bzbarsky)
Details
Attachments
(1 file, 1 obsolete file)
1.40 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 When cloning a file input (with an existing value) from a form in one document to another (eg. to a form in an iframe), submitting the form using the submit() method causes the file input to lose its value. Its name persists but the filename and data don't. If the form is submitted manually with a submit button, it works perfectly. Reproducible: Always Steps to Reproduce: 1. Enter a file into a file input 2. Use cloneNode to append it to a form in another document 3. call the submit() method on that form, rather than clicking the submit button Actual Results: The element name is sent, but the filename is blank and there's no data. Expected Results: The element should be sent as normal. Example output: (two form values and the file) -----------------------------214762178421665 Content-Disposition: form-data; name="aupload_file_id" d41d8cd98f00b204e9800998ecf8427e -----------------------------214762178421665 Content-Disposition: form-data; name="aupload_file_name" -----------------------------214762178421665 Content-Disposition: form-data; name="myfile"; filename="" Content-Type: application/octet-stream -----------------------------214762178421665--
Assignee | ||
Comment 1•19 years ago
|
||
So the actual issue here (based on debugging Arpad's testcase) is that we're submitting before initial reflow of the file control frame, and that can't get the value off the mTextFrame until it sets it... in initial reflow. The cross-document thing and the cloneNode thing are incidental -- you could get the same effect with some style toggling on a single file input in the DOM.
Assignee: nobody → bzbarsky
Status: UNCONFIRMED → ASSIGNED
Attachment #209331 -
Flags: superreview?(roc)
Attachment #209331 -
Flags: review?(roc)
Assignee | ||
Comment 2•19 years ago
|
||
roc, I realize that for 1.9 we'll try to nix the whole textfield thing, but I think this might be a good change for 1.8.1 too...
OS: Windows XP → All
Priority: -- → P3
Hardware: PC → All
Summary: cloneNode(file input) between documents loses value on submit() → [FIX] Submitting file control that's just been added to the DOM fails
Target Milestone: --- → mozilla1.9alpha
Comment on attachment 209331 [details] [diff] [review] Patch I agree with your XXX comment. Seems like textControl.value should always work.
Attachment #209331 -
Flags: superreview?(roc)
Attachment #209331 -
Flags: superreview+
Attachment #209331 -
Flags: review?(roc)
Attachment #209331 -
Flags: review+
Assignee | ||
Comment 4•19 years ago
|
||
I made this always use mTextControl.
Attachment #209331 -
Attachment is obsolete: true
Assignee | ||
Comment 5•19 years ago
|
||
Er, I meant mTextContent. In any case, fixed.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•