...

appendChild / cloneNode + frames + ie = :(

Ökii
03-31-2004, 09:22 AM
Hi All, long time no see.

The problems I am having are with trying to get IE to successfully clone a referenced node from one frame and inport it (with all form values etc) to another frame.
Moz works fine with

oFilters = document.getElementById('saveElement');
oFilters.appendChild(parent.frames[frameref].document.getElementById('e_'+elemref).cloneNode(1));

I have tried iterating the specified node and using createElement to create a copy in the desired place, which works fine with simple input type text or hidden. The first snag comes when trying the same with textareas. The cloned form doesn't submit the values :(

Any ideas?

Sample IE function - works for basic inputs

function portNode (oNode) {
oElems = document.getElementById('saveElement');
switch (oNode.nodeName) {
case 'INPUT':
oIn = document.createElement("input");
oIn.setAttribute("type", "hidden");
oIn.setAttribute("value", oNode.value);
oIn.setAttribute("name", oNode.name);
oElems.appendChild(oIn);
break;
case 'TEXTAREA':

break;
default:
break;
}
for (var oChild = oNode.firstChild; oChild; oChild = oChild.nextSibling) {
portNode(oChild);
}
}

liorean
03-31-2004, 09:36 AM
Just a question: Does the textarea appear in the document.forms[formname].elements collection? If it doesn't, try to add it to the end of that collection.

Ökii
03-31-2004, 10:29 AM
The textarea does appear within the form->elements collection within the remote frame, it is then *cloned* to a div that sits within the local form.
I have just tried a node iteration idea with appendChild and can then alert values from the cloned elements. Main problem is that once the form is submitted the textarea values are not sent to the server.
Will try directly appending them to the form anyway.

liorean
03-31-2004, 12:55 PM
Well, what I meant was, does the new elements appear in the document.forms[formname].elements collection of the new document? I wasn't talking about where they appear in the original document. See, just because the element is added to the document at tghe correct place it doesn't necessarily get inserted into that collection, a bug we have seen in iew before.

Another thing you could try would be to change the way you set it's value from using [object Element].setAttribute to using [object HTMLTextAreaElement].value.

Ökii
03-31-2004, 02:22 PM
Am now trying a different tact on this one - moved the forms together within the same document.

Someone do me a favour and kill IE ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum