CCNewsletter Runtime Error in Internet Explorer

So I had a client who upgraded to CCNewsletter 1.0.7. His business is heavily reliant on newsletters and he is an avid internet explorer user. He tried to send a newsletter and the first batch worked fine. However, after the countdown, the interface freezes and a run time error is generated. This causes the rest of the batches fo fail. Here is the specific error:
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDC; .NET CLR 1.1.4322)
Timestamp: Wed, 26 May 2010 17:15:14 UTC

Message: Unknown runtime error
Line: 416
Char: 4
Code: 0
URI: .../administrator/index.php?option=com_ccnewsletter&controller=sendNewsletter&task=ccsend_all_first&id=18
Upon digging into the code, I found this to be a javascript problem for internet explorer. Firefox and most other browsers should work fine. The problem is that ccnewsletter is trying to write to the tbody of a table using innerHTML. That will not work in ie, as ie does not allow innerHTML on table tags. The only real solution is to use insertRow, insertCell, etc as per the dom requirements. This solution should work on all browsers. In www/administrator/components/com_ccnewsletter/views/sendnewsletter/tmpl/ccsend.php On or around line 76
document.getElementById('result_tbody').innerHTML += responseText;
Needs to be replaced with this:
//document.getElementById('result_tbody').innerHTML += responseText;
responseText = responseText.substr(21);
arData=responseText.match(/<td[^>]*>(.|\n)*?(?=<\/td>)/ig);
col = 0;
var myRow = null;
for(i=0,len=arData.length;i<len;i++) {
    if(col%3 == 0) myRow = document.getElementById('result_tbody').insertRow(-1);
    var myCell = myRow.insertCell(-1);
    if(col%3 != 1) myCell.style.textAlign = 'center';
    myCell.innerHTML = arData[i].replace(/<td[^>]*>/i,''); 
    col++;
}
if(responseText.indexOf('<input id="stop" value="stop" type="hidden" />') != -1) {
    myRow = document.getElementById('result_tbody').insertRow(-1);
    var myCell = myRow.insertCell(-1);
    myCell.colSpan = arData.length;
    myCell.innerHTML = '<input id="stop" value="stop" type="hidden" />'; 
}

Comments

  1. blaauw
    Guest 6 years ago
    HI.

    Now i am getting this error


    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MDDC; InfoPath.3; .NET4.0C)
    Timestamp: Tue, 13 Jul 2010 15:04:00 UTC

    Message: Expected ')' in regular expression
    Line: 299
    Char: 51
    Code: 0
    URI: http://localhost/ccNewsletter/administrator/index.php?option=com_ccnewsletter&controller=sendNewsletter&task=ccsend_all_first&id=1


    Message: Object expected
    Line: 1
    Char: 1
    Code: 0
    URI: http://localhost/ccNewsletter/administrator/index.php?option=com_ccnewsletter&controller=sendNewsletter&task=ccsend_all_first&id=1
    • blaauw
      seyi 6 years ago
      Yes, you are right, the page was stripping out "\" characters. This has been fixed. The code should work now.
      • blaauw
        Guest 6 years ago
        Works ! , Thanks you very much
    • blaauw
      Guest 4 years ago
      I'm really impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the nice quality writing, it is rare to see a great blog like this one nowadays..
      wesdf