Solved

Javascript : InputFile.Click() Access is denied.

Posted on 2006-06-21
5
425 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

687 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