Closed
Bug 201178
Opened 23 years ago
Closed 23 years ago
Can't send click event to "Browse..." button of File Upload control
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: gerv, Unassigned)
References
Details
I'd like to use JS to invoke the "Browse" button on a File Upload control. In
IE, I can do document.forms[0].myfilecontrol.click(), and it Does The Right
Thing. In Mozilla, the onclick() handler doesn't fire.
Via glazman, I found that this is because DOM Level 2 says:
http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-6043025
click
Simulate a mouse-click. For INPUT elements whose type attribute has one of
the following values: "button", "checkbox", "radio", "reset", or "submit".
So that might be that. But it's a bit pants, really - see the usage scenario
below. Accessibility people also appear to be having trouble with this:
http://lists.w3.org/Archives/Public/w3c-wai-ua/2001AprJun/0048.html . Is there
any way we can make this happen? I don't think it would be a security issue,
because the user has to choose the file themselves.
[ Usage Scenario: I have a JS menu system for my web application; one item is
"Upload File". I'd like clicking that item to trigger the browse button on a
hidden File Upload control; when the user clicks OK on the file dialog,
onchange() would fire (that doesn't work either in Moz, currently) on the input
element and that could submit the hidden form, and the file would just get
uploaded. Slick. ]
Gerv
Comment 1•23 years ago
|
||
I would say that a dialog suddenly popping up for no reason prompting the user
to select a file and immediately uploading the file once the user selects it
would indeed be a security issue unless we make it _very_ clear why that
filepicker came up.
Comment 2•23 years ago
|
||
I second that.
| Reporter | ||
Comment 3•23 years ago
|
||
So how could we make it clear what's going on? The title bar of the filepicker
says "File Upload" already.
My usage scenario is, I believe, appealing if we can make it work safely.
Gerv
Comment 4•23 years ago
|
||
The title bar on the file picker is not even present in many instances (it's a
transient modal window, which a lot of window managers do not decorate by default).
| Reporter | ||
Comment 5•23 years ago
|
||
Hmm. Then perhaps there's no good solution to this - which is a shame, because
the idea is cool.
Gerv
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Comment 6•21 years ago
|
||
*** Bug 282232 has been marked as a duplicate of this bug. ***
*** Bug 285725 has been marked as a duplicate of this bug. ***
Updated•7 years ago
|
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•