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 7 of 7
  1. #1
    New Coder
    Join Date
    Oct 2002
    Location
    São Paulo, BRAZIL
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer problems with forms and dynamic input elements

    Hello folks, could someone tell me why a dynamic input text connot be accessed from a form objet? For example:

    function test( )
    {
    var frm = document.forms[ 0 ];
    var tmp = null;


    tmp = document.createElement( "input" );
    tmp.setAttribute( "type", "hidden" );
    tmp.setAttribute( "value", "Testing a new input" );
    tmp.setAttribute( "name", "hdnTest" );


    frm.appendChild( tmp );

    //Now it should work:
    alert( frm.hdnTest.value );
    }


    With Mozilla it work perfect!

    Regards,
    LottaLava

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm .. might be IE being funny with setAttribute .. I can't remember the details of its problem, but try this

    tmp.setAttribute( "value", "" );
    tmp.value = "Testing a new input";

    And if it's not that, try the same modification to each of the other setAttribute calls
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    New Coder
    Join Date
    Oct 2002
    Location
    São Paulo, BRAZIL
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The problem isn´t that, what happens is about we cannot see hdnTest.

  • #4
    Regular Coder
    Join Date
    Aug 2003
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts
     ........ another wild guess ........

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Ie has the problem that it's DOM implementation is built on top of it's document handling and rendering engines instead of into them. This leads (at least in some cases) to not including dynamically created form fields in the forms elements collection, and it doesn't submit them either. It's a problem that has existed in some form in all browsers, and is in iew not corrected.
    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

  • #6
    New Coder
    Join Date
    Oct 2002
    Location
    São Paulo, BRAZIL
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you folks, i must say something about M$ IE, it sucks a lot!

    Regards,
    LottaLava

  • #7
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    It doesn't suck much, it's just old and underdeveloped/stagnated. Look at where Netscape/Mozilla, Opera and Konqueror stood when ie6w was created - it was the best at DOM and close to ie5m at css. Then moz wiped it off the floor with it's DOM support while op did the same with it's CSS support.
    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


  •  

    Posting Permissions

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