Urgent!!! Character count issue

Last post 01-24-2006, 1:49 PM by Adam. 1 replies.
Sort Posts: Previous Next
  •  01-24-2006, 11:37 AM 15048

    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)
  •  01-24-2006, 1:49 PM 15057 in reply to 15048

    Re: Urgent!!! Character count issue

    Don,
     
    The correct way to get the HTML out of the editor is using the following method:
     
    var contentn = editor1.getHTML();



     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML