SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast nickweavers's Avatar
    Join Date
    Feb 2004
    Location
    Hampshire, UK
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help needed with "Object required" syntax error in IE7

    Hi,

    I have a php function that is invoked by an asyncRequest that returns xml as follows:
    Code:
    $_xml ='<?xml version="1.0" standalone="yes"?>';
    $_xml = '<file_upload>';
    $_xml .= '  <success>'.$success.'</success>';
    $_xml .= '  <error_message>'.$error_message.'</error_message>';
    $_xml .= '  <temp_filename>'.$base_file.'</temp_filename>';
    $_xml .= '</file_upload>';
    echo $_xml;
    The javascript (first few lines shown below) in the upload response function which processes the XML-DOM works just fine in Firefox but in IE7 gives a syntax error popup saying "Line: 518, Char:3, Object required".
    Code:
    518 var xmlDocument = o.responseXML;
    519 var success = xmlDocument.getElementsByTagName("success")[0].firstChild.nodeValue;
    520 // If the file upload was not a success show the error message and exit
    521 if (success == 'FALSE') {
    522   var error_message = xmlDocument.getElementsByTagName("error_message")[0].firstChild.nodeValue;
    523   errorMessagesDiv.innerHTML = "Error: " + error_message + " Please choose a larger image.";
    524   errorMessagesDiv.style.display = "block";
    525 return;
    526 }
    If I change line 518 to
    Code:
    var xmlDocument = new Object;
    xmlDocument = o.responseXML;
    IE7 seems to be happy with that but then issues the same syntex error for line 519. I am expecting the nodeValue assigned to error_message to be a string so why is IE7 saying it is expecting this variable to be an object?

    Can someone tell me what I am doing wrong.

    TIA,
    Nick.

  2. #2
    SitePoint Enthusiast nickweavers's Avatar
    Join Date
    Feb 2004
    Location
    Hampshire, UK
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My dumb error.

    $_xml ='<?xml version="1.0" standalone="yes"?>';
    $_xml = '<file_upload>';

    should have been

    $_xml ='<?xml version="1.0" standalone="yes"?>';
    $_xml .= '<file_upload>';

    Thanks to all who took the trouble to read my post.
    Nick.

  3. #3
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    can you give all your javascript... or even better would be a working model or just something where i can debug it in IE?

    seems like you are doing it right... but if you give a working model i can test it,
    -ALL
    Did I help you?
    You can repay me, support one of my projects (no money needed):
    JavaScript Wiki, Another Web Forum, Paranormal Site


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
  •