Text.length inaccurate

Last post 09-29-2006, 3:15 PM by Adam. 7 replies.
Sort Posts: Previous Next
  •  09-24-2006, 7:10 AM 23012

    Text.length inaccurate

    Greetings:
    Before saving the text contents of a Cute Editor instance to database, I put a test for length in the dot-net vb code....

    [CuteEditorID].Text.Length

    ...What I'm finding is that this returns a value wildly larger than the length of the text assigned to the database field, or the contents of the editor HTML window. As an example, with the CuteEditor HTML window displaying....

    That's right, I'm a mouse!!!!!<img src="http://cutesoft.net/test/CuteSoft_Client/CuteEditor/images/face6.gif" align="absmiddle" border="0"><br>


    ...[CuteEditorID].text.length returns a value of 758. Why is this?

    Thanks.
  •  09-25-2006, 2:28 PM 23050 in reply to 23012

    Re: Text.length inaccurate

    I'm also not sure what MaxHTMLLength does...I set the limit in code, but still have not managed to trigger it...
  •  09-25-2006, 4:30 PM 23055 in reply to 23050

    Re: Text.length inaccurate

    jjonesdtrt:
    I'm also not sure what MaxHTMLLength does...I set the limit in code, but still have not managed to trigger it...
     
    jjonesdtrt,

    Editor.MaxHTMLLength Property

    Gets or sets the maximum number of characters including the HTML tags allowed in the Cute Editor. Default is zero, indicating no maximum.
     
    Demo:
     
    Use MaxHTMLLength or MaxTextLength to Protect Your Database
     

    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

  •  09-25-2006, 4:41 PM 23056 in reply to 23055

    Re: Text.length inaccurate

    Thanks...sorry, thought it was a physical limit within the box (like a textbox limit), missed the error message.
    Where is that error message? I'd like to customize it just a bit.

    Also, how about the other question above?

  •  09-25-2006, 9:18 PM 23064 in reply to 23056

    Re: Text.length inaccurate

    jjonesdtrt,
     
    With the above html code, I got the value of length is 139.
     
    Can you post your VB.NET code?
     
     

    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

  •  09-26-2006, 5:59 AM 23071 in reply to 23064

    Re: Text.length inaccurate

    I removed the VB length check since I thought I'd just use MaxHTMLLength to check, so there actually isn't any VB code to look at. I'll give you everything I think might be relevant - tell me if there's anything else you want to see. As you can see from my SQL statement, there is more going on in the page than just saving the CuteEditor text.

    -------------------

        CEEntry.MaxHTMLLength = 750

    ...sets the limit. This is in a subroutine triggered at page load...it sets a lot of other things, so I know that's working fine. If I remove that limit, the save routine passes with a SQL Server limit of 750 characters for field UserAutoSig....

             mySQL = "Update Users Set " & _
               "LastUpdate = convert(datetime,'" & Now().ToString & "'), " & _
               "UserFirstName = '" & Replace(TextBoxUserFirstName.Text,"'","''") & "', " & _
               "UserLastName = '" & Replace(TextBoxUserLastName.Text,"'","''") & "', " & _
               "UserEmail = '" & Replace(TextBoxUserEmail.Text,"'","''") & "', " & _
               "UserDisplayName = '" & Replace(TextBoxUserDisplayName.Text,"'","''") & "', " & _
               "UserAutoSig = '" & Replace(CEEntry.Text,"'","''") & "' " & _
               " Where UserID = " & mUserID.TOString

    LabelNewError.Text="CuteEdit Length = " & CEEntry.Text.Length.ToString

    ...was what I was using to read out the length of the CuteEditor instance. Before I found it was misrepresenting it, I was using...

    If CEEntry.Text.Length > 750 Then
       LabelNewError.Text="Your autosig is too long. Trim it and try again."
      Exit Sub
    End If

    My last test gave the max reached error with an HTML window of

    This is a test!! I want to be a mouse!<br>

    -------------------------------------------

    I would really much prefer handling the error myself, since with limits set within Cute Editor, no other routine (including logging out of my site) will run without Cute Editor blocking it, if it perceives the limit has been passed. Even abandoning the edit by navigating away from the page gives the error, which  means the user has two dialog boxes to click past (the length error, plus a "you are attempting to navigate away..." to leave the page.

    I'm using CuteEditor all over my site now, and with the exception of the media problem I mention in another thread, it's working great. But this has me hamstrung in new registration and profile editing...I'm tempted to just capture the SQL Server error and do it that way.
  •  09-29-2006, 2:21 PM 23226 in reply to 23071

    Re: Text.length inaccurate

    Do I need to submit this as a trouble ticket? I am a registered owner of CuteEditor...
  •  09-29-2006, 3:15 PM 23230 in reply to 23071

    Re: Text.length inaccurate

    jjonesdtrt,
     
    CEEntry.Text is a property of Cute Editor. This property will return HTML content of Cute Editor.
     
    .Length is property of String Class.
     
    So the following code is correct.
     
    "CEEntry.Text.Length > 750"
     
    So I think the problem is somewhere else.
     
    Please try CEEntry.PlainText.Length and see what it returns.
     
    If you still can't figure it out, let us create a simple example and work on the String.Length issue only.
     
     
    Editor.PlainText Property 
     
    Retrieves the CuteEditor HTML content in plain text format.
     

     

    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