Urgent!!! Character count issue

  •  01-24-2006, 11:37 AM

    Urgent!!! Character count issue

    Hi Adam:
     
         We are currently using cuteEditor and javascript to count the number of characters entered in cuteEditor. Presently in our db we 2nvarchar columns of length 4000 to hold plainText and htmlText.
     
    In the javascript we are doing the following for getting the plainText and htmlText:
    this.getHTML = function (){
     
    return richDoc.body.innerHTML;
    }

    this.setHTML = function (val)

    {

    richDoc.body.innerHTML = val;

    }

     
    We are also having a character count function that counts the number of characters returned by say getHtml.length
     
    We have noticed the following strange problem......
    Case enviroment : We are using cuteEditor in a popup.
    (1) Initially we have an empty cuteEditor when the popup is launched and we have count(The max chars that can be successfully saved to db) = 4000 which means that we can type 4000 characters of html that can be saved successfully. We also associate a keypress event so that when user presses a key the count changes to show the max characters that can be entered. Then say user types 'Hello'. The count shows us 4000 - (11 + 5) [4000 is the max we can type, 11 is for the tags of div and 5 for the hello, so even the count works great here.]. Then user says submit. Then it saves to db and the column in db has <Div>Hello</Div>. When the user calls back the popup we set the html text on server side to the control. Then the count does not show us 4000 - (11 +5) anymore. It shows values much less than this. This indicates that the editor must have added some more html characters or tags. Why does it do this??? We noticed the above issue when there is a lot of text in the editor say 'ajfjakljfafjlkajflkajflkjaklfjlkajflkajflkajlkfjalkjfklajflkjalfkjalkfjalkjflkajflkajfklajlk'.

    Thanks and regards,

    Don P.
    (2)
View Complete Thread