Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript : InputFile.Click() Access is denied.

Posted on 2006-06-21
5
Medium Priority
?
427 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 375 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

610 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