NetSpell Integration - Trigger Spell Check Externally

  •  02-05-2010, 1:35 PM

    NetSpell Integration - Trigger Spell Check Externally

    We're trying to integrate CuteEditor with the standard NetSpell code. What I've done is renamed all the functions from the basic spell.js I downloaded from the NetSpell project, and added the SpellCheck.aspx to the project. The independent NetSpell install works on everything just fine, but when it hits a CuteEditor TextArea the data isn't correct. 
     
    CuteEditor's spell check currently functions just fine, but we're trying to allow the users to spell check everything on the page with the click of one button. So, I've been trying to trigger the CuteEditor internal SpellCheck functionality by creating a special case for the CuteEditor text areas, which all have CuteEditor in their ID since I've named them as such. Unfortunately, I don't have the clientID of each editor as we're creating them dynamically. Whenever this code hits a CuteEditor text area and calls ExecCommand, it fails because the method doesnn't exist. Is there anything I can do to trigger the spell check functionality using the ID of the textarea?
     
    JavaScript for the checkSpelling() function is below:
    1. function NScheckSpelling()   
    2. {   
    3.     NScheckElements = new Array();   
    4.     //loop through all tag groups   
    5.     for (var i = 0; i < NStagGroup.length; i++)   
    6.     {   
    7.         var sTagName = NStagGroup[i];   
    8.         var oElements = document.getElementsByTagName(sTagName);   
    9.         //loop through all elements   
    10.         for(var x = 0; x < oElements.length; x++)   
    11.         {   
    12.             if (oElements[x].id.indexOf("CuteEditor") != -1){   
    13.                 var editor1 = document.getElementById(oElements[x].id);   
    14.                 try{   
    15.                     editor1.ExecCommand("netspell");   
    16.                 }   
    17.                 catch(e){   
    18.                     alert("Error for CE: " + oElements[x].id + " -- Exception: " + e.description)   
    19.                 }                   
    20.             }   
    21.             else{   
    22.                 if ((sTagName == "INPUT" && oElements[x].type == "text") || sTagName == "TEXTAREA"){   
    23.                     NScheckElements[NScheckElements.length] = oElements[x].id;   
    24.                 }                   
    25.                 else if ((sTagName == "DIV" || sTagName == "SPAN") && oElements[x].isContentEditable){   
    26.                     NScheckElements[NScheckElements.length] = oElements[x].id;                   
    27.                 }                   
    28.             }               
    29.         }   
    30.     }   
    31.     NSopenSpellChecker();   
    32. }  
    Thanks,
    William
    Filed under:
View Complete Thread