|Page 1 of 1||[ 6 posts ]|
I have an asynchronous application , which is using file upload.
In order to achieve this , i use the setForm(form,true) , which enables fileupload , according to the documentation.
As i understand it , this works by creating a hidden iframe, and submitting the form with as target the iframe.
In the page i'm showing , this works fine. After performing the call , i can retrieve the content with the upload callback function.
However , the problem i have is that the iframe itself is throwing script errors.
To clarify , i'll explain the setup of my application :
- I have a start page (base.jsp ) , which loads synchronously at start
- This page includes certain script files in the head , needed in the application
- The page content a 'content' div , in which i load the content i asynchronously retrieve from the server.
- This content contains scripts , which use functions from the included script files in the head
The problem is the following :
=> When doing a fileupload , the retrieval of the page is done by using the hidden iframe
=> When the content is loaded into this iframe , it executes the scripts .
=> However , in the content , i'm not loading the script in the head again , as otherwise they would be loaded twice in the actual screen
=> As a result , i'm getting script errors in the iframe , as it cannot find my script includes there.
Is it possible to block script executing in the iframe , or tell the browser that it shouldn't interpret the html ?
The docs for GET are at http://developer.yahoo.com/yui/get/#script for what its worth.
The script file is just loaded in the page itself .
The problem is the content i get back from the server , which calls function that are in the script file.
The content is put inside a container div , and then the scripts inside the updated container are updated , calling scripts that are defined in the head ( the head contains script files which are used ).
This all works in normal asynchronous requests.
However , when you do asynchronous request with fileupload ( setForm with second parameter to true ) , it puts the content in an iframe first ( creates a hidden iframe ).
The problem is that this iframe already tries to execute the scripts , but since the content is using functions from a script file , it cannot load them , and gives script errors.
So , if after uploading a file , you want to show updated content on the screen , and iframe will be created , which tries to execute scripts functions that are not loaded in the iframe itself.
What i would want is that the browser doesn't interpret those scripts in the iframe , and just uses the iframe as a conduit. But i'm not sure that is possible ?
Kenny, I think I understand ... you are getting errors locally (on the YUI client) BEFORE you send the file "down the wire" to your server, correct?
Can you post a link or a link to a pastie location to look at some of your code?
As followup, I am able to upload mixed HTML / Script files to the server using setForm with Connect.asyncRequest. Checked it on FF 3.6, Chrome and Safari (not IE). Make sure your form tag includes the proper encoding ..
<form method="post" id="myForm" action="myaction" enctype="multipart/form-data">
|Page 1 of 1||[ 6 posts ]|
|You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum