SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onsubmit fails in IE

    I have created a simple form for uploading text files. You can see two versions of it at:

    I am too new to post a link in this forum, but you can see examples of the form at wiseware dot com slash test.

    The one created with static HTML works fine in current versions of major browsers. However, the one created with javascript, fails (only) in IE.

    Can anyone help me understand what is going on here?

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The <body> is there in the HTML. It includes the onload="initialize();" that builds the page. I don't think another <body> would be a good idea.

    Thanks

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did a recheck and saw that, and deleted my message since it had no useful information. Sorry for my mistake.
    Each day is a learning experience.

  4. #4
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It turns out that a bug in IE precludes specifying the "name" attribute dynamically. The only workaround is this ugly business:

    var b = document.getElementsByTagName('body')[0];
    b.innerHTML = '<div id="uploadDiv" style="width: 500px; padding: 5px; margin-bottom: 5px; border: 1px solid #3333FF;">'+
    '<form id="uploadForm" action="upload.php" method="post" enctype="multipart/form-data">'+
    '<input id="uploadInput" type="file" name="uploadFile">'+
    '<br />'+
    '<input type="submit" value="Submit">'+
    '</form>'+
    '</div>';

    Thanks.

    If anyone knows of a less ugly solution, I would be glad to hear about it.

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

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