Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts

    appendChild / cloneNode + frames + ie = :(

    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

    PHP Code:
    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.firstChildoChildoChild oChild.nextSibling) {
            
    portNode(oChild);
        }

    Íkii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeň, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Íkii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeň, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    Last edited by liorean; 03-31-2004 at 12:57 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Íkii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •