Solved

Javascript : InputFile.Click() Access is denied.

Posted on 2006-06-21
5
421 Views
Last Modified: 2008-02-01
HI everyone ,

What should be happening :

When you select a product from the listbox, a File selection window will open to select an image for that product. So far, when i select a product, the file selection window is opened, once i have selected a file, i click open and then i get an Access is Denied error for calling submit_NewFreeItem() with the "onpropertychange" event from the File input.  

Take notes that if i click the Browse button from the Input File and select a file, everything works fine, the script calls the submit click. But when i call the Browse button from a script .click() it gives me this Access is denied error.

Thanks for checking it out,

Here is the partial code for this error :

<script language="javascript">
               
                function submit_NewFreeItem()
      {
            document.all.submitNewFreeItem.click();
      }
      function NewFreeItem_Click()
      {
            document.all.NewFreeItem.click();
      }
</script>

...

<select name='ProductToAdd' onchange='NewFreeItem_Click()'>
<option value='0' selected>No Product Selected</option>
<option value='1'>Test</option>
</select>

<INPUT type=file id="NewFreeItem" name="NewFreeItem" onpropertychange="submit_NewFreeItem()">

<INPUT type="submit" style="display:none" name="submitNewFreeItem" id="submitNewFreeItem" value="submitNewFreeItem">


...
0
Comment
Question by:darkben
  • 3
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 125 total points
ID: 16951370
That is correct. You also cannot access the "value" property and other properties of the fileinput field. As part of the browsers security settings. Cannot be overridden though.

-r-
0
 

Author Comment

by:darkben
ID: 16951446
Any of you have a workaround for this ? :(
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 16951463
No.

-r-
0
 

Author Comment

by:darkben
ID: 16951502
Even tho i tried putting all browser security to the lowest, still doesnt work.

So your telling me there is no way i can auto submit my form after the file selection when the file selection has been poped with a script ?
0
 
LVL 49

Expert Comment

by:Roonaan
ID: 16951548
You can try form.submit().

-r-
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question