Closed Bug 282232 Opened 20 years ago Closed 20 years ago

calling click() method from javascript on file input form element does not work as expected

Categories

(SeaMonkey :: General, defect)

x86
Linux
defect
Not set
major

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 201178

People

(Reporter: carstenklein, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217


Calling the click() method of a file input form element does not open the file
requester, i.e.

<form name = "FileUploadTest" enctype = "multipart/form-data" method = "post"
action = "uploader.php">
<input style = "visibility:hidden;" type = "file" name = "FileUpload">
<input class = "FancyButton" value = "Upload" onClick = "if ( upload() )
document.forms[ \"FileUploadTest\" ].submit();";>
</form>

<script>
function upload()
{
     elt = document.forms[ "FileUploadTest" ].elements[ "FileUpload" ];
     elt.click();
     if ( elt.value != "" )
     {
         return true;
     }
     return false;
}
</script>


Reproducible: Always

Steps to Reproduce:
1. try the above semi-test-case
2.
3.

Actual Results:  
nothing

Expected Results:  
I would expect Mozilla to invoke the file requester in order to have a different
button instead of the default file input button, which is in no way styleable or
otherwise controllable.


Besides the aforementioned problem, the file input form element also does not
allow styling of the "Browse..."-labelled button at all. Furthermore, the label
I was not able to replace with a custom text, for example "Upload..." and, what
is more, I was not able to hide the input text box in favour of only providing a
Upload button that would fit nicer into the user interface scheme I am currently
developing for a site I am doing.

Is this a safety issue? If so, why the heck must we reasoning-capable people
suffer from the inability of some und consequently must develop web-applications
that are simply just way below what is expected for a standard user interface
compatible application and a given style guide that is to be expected to be
implemented?
Yes mostly a security issue.

*** This bug has been marked as a duplicate of 201178 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Summary: calling click() method from javascript on file input form element does not work as expected → calling click() method from javascript on file input form element does not work as expected
You need to log in before you can comment on or make changes to this bug.