Solved

Javascript : InputFile.Click() Access is denied.

Posted on 2006-06-21
5
423 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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…

735 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