You need to call: parent.doMyFancyUpdate();

...since you are talking to the parent frame and not the frame that
completed the upload.

On Jan 1, 9:32 am, Robert <[EMAIL PROTECTED]> wrote:
> Hello together.
>
> I'm trying to call an Ajax.Updater from within an IFrame to update an
> element in the parent window.
> It is working, but I receive an error from Firefox when I do so.
> What I want to do is to upload a file, and then after the file has
> completed uploading, automatically reload a section of the page with
> information about the file to post-process it.
> However, AJAX doesn't like file uploads, so my only choices are the
> (hidden) IFrame approach or a flash/perl/whatever scenario, which
> seems too much for the simple task I'm trying to achieve.
>
> This is the code I'm using (simplified, but same functionality):
>
> function doMyFancyUpdate()
> {
>         // myUpdateID is within the parent frame
>         var myID  = top.document.getElementById('myUpdateID');
>         var myURL = 'showfile.php';
>
>         new Ajax.Updater(
>                 myID,
>                 myURL,
>                 {
>                         method: 'post',
>                         onException: function(ele, ele2) { alert("Error!\n" + 
> ele2.message
> +"\n"+ ele2.fileName +"\nLine:"+ ele2.lineNumber); }
>                 }
>         );
>
> }
>
> In the IFrame itself I am simply calling a <script>doMyFancyUpdate();</
> script>. And these are the error messages I receive:
>
> With the alert command:
> [Exception... "Component returned failure code: 0x80004005
> (NS_ERROR_FAILURE) [nsIDOMWindowInternal.alert]"  nsresult:
> "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
> functions.js :: anonymous :: line 752"  data: no]
> Line 752 would be the alert part of the function
>
> When I commented out the alert command within onException:
> Ajax is not defined
> prototype.js
> Line 1352
> "Ajax.Responders.dispatch('onException', this, exception);"
>
> And finally when I removed the onException part entirely:
> Prototype is not defined
> prototype.js
> Line 1351
> "(this.options.onException || Prototype.emptyFunction)(this,
> exception);"
>
> When I directly call an Ajax.Updater within the IFrame, without a
> functional reference, I receive the third error. The update itself is
> still working though.
>
> Setting myID to only 'myUpdateID' doesn't work, it doesn't update
> anything at all, although it does call the updater (I assume that it
> tries to find the ID within the IFrame and update this one, which of
> course doesn't exist there).
>
> I searched the net a bit and found this 
> site:http://www.fleegix.org/articles/2006/10/21/xmlhttprequest-and-0x80004...
> I tried the solution posted there (created a dummy function that calls
> my real function), but it didn't help at all.
>
> So, is there any solution or workaround? Did anybody try something
> similar already?
> In IE6 it seems to work fine, at least I don't receive an error.
>
> Thank you for your help,
> Robert
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to