PDA

View Full Version : Moving file input to different form doesn't work in IE7



anderzons
03 Mar 2010, 04:58 AM
Hi!
I have form inside iframe. I want to copy form to parent window after user entered data and then submit.
Everything works fine, except with file input.
It seems impossible to move file input(after user selected file) to different form in different document (only ie7).
Here is javascript code im using inside iframe to move form elements:


var parentForm = parent.document.getElementById('editGallerieFormParent');
parentForm.ordering.value = form.ordering.value;
parentForm.catname1.value = form.catname1.value;
parentForm.description.value = form.description.value;
var copy;
if( !!document.all ) { //ie
/* ie8 fix */
// clone up a new one
var oldFile = form.i_file;
var newFile = form.i_file.cloneNode(true);

// set props
newFile.id = "i_file";
newFile.name = "i_file";

// replace old with new
oldFile.parentNode.replaceChild(newFile, oldFile);

// attach old to upload form
parentForm.appendChild(oldFile);
} else { //firefox
copy = form.i_file.cloneNode(1);
parentForm.appendChild(copy);
}



parentForm.konkurss_end_date.value = form.konkurss_end_date.value;
parentForm.submit();

on ie7 i recieve error "Invalid argument" at parentForm.appendChild(oldFile);

How to fix this?

raul21
21 Jan 2011, 09:31 AM
Hello, I am having exactly the same problem. Did you manage to fix it?

Thanks