Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Brian on Sep 02, 2009 06:49
open dhtmlx forum
Possible bug found in dhtmlxError.catchError in IE

I have a web application that is using the loadXML to retrieve grid data as xml. In this application I also define a custom function to handle the the dhtmlxError, dhtmlxError.catchError("ALL", viewByErrorHandler); The error handling on the server side returns a JSON object that contains details of the error encountered on the server side during request processing.

The code for the viewBYErrorHandler is as follows:

*************************************************
function viewByErrorHandler(type, desc, erData){
    xmlHttp = erData[0];
    msgData = xmlHttp.responseText.evalJSON(true);
    if ( msgData == null ){
        return false;
    }
    try{
        if ( msgData.dataErrorOccurred ){
            msgText = msgData.messageText;
            if ( msgText == null ){
                return false;
            }
        
            if ( msgData.type == 'noLabelsFound'){
                msgblock = "<span class='error'>";
                msgblock = msgblock + msgText;
                msgblock = msgblock + "</span>";
                
                if ( $('application-status') != null ){
                    $('application-status').innerHTML = msgblock;                    
                }
            }
        }
    } catch (e){
        return false;
    }
    return false;
}
********************************************************

The issue I am running into is once the viewByErrorHandler is called, any subsequent call to the load the grid using loadXML results in the prototype.js evalJSON function being called to process the returned response data. Since this is not a JSON object but XML, it results in an exception stating the repsonse data is not a valid JSON object.

If I change all my loadXML calls to use the load(url, callback_function, "xml"), everything works fine.

Also, please note that this only happens in Internet Explorer and not in Fire Fox.
Answer posted by Alex (support) on Sep 02, 2009 09:48
Answer posted by Support on Sep 02, 2009 09:54
Please be sure that xml data is sent with correct type
           Content-type:text/xml
In case of different content type , there is a possibility of such issue in IE.

Attached dhtmlxcommon.js contains fix for the possible issue, you can try to use it instead of the original one. 
Attachments (1)
Answer posted by Brian on Sep 02, 2009 10:46
Thanks for the quick response.  The Content-type:text/xml was the root of the issue.  The server side code
was not setting the response type to text/xml.  After making this change, everything appears to be functioning
correctly in both IE and Firefox.