Solved

Javascript : InputFile.Click() Access is denied.

Posted on 2006-06-21
5
413 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
Comment Utility
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
Comment Utility
Any of you have a workaround for this ? :(
0
 
LVL 49

Expert Comment

by:Roonaan
Comment Utility
No.

-r-
0
 

Author Comment

by:darkben
Comment Utility
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
Comment Utility
You can try form.submit().

-r-
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now