How to avoid illegal / invalid HTML Code

Last post 07-31-2009, 1:40 AM by Kai2. 5 replies.
Sort Posts: Previous Next
  •  07-29-2009, 2:54 AM 54358

    How to avoid illegal / invalid HTML Code

    Hi all,
     
    the problem is not caused directly by CuteEditor but the data is added using CuteEditor so I hope there is a solution:
     
    How could I check whether the entered text is valid HTML? Sometimes my users enter invalid HTML without knowing, e.g. a text like
     
    <!-- Test />
     
    (The tag is not closed correct, the end is wrong. The correct tag would be: <!-- Test --> )
     
    That's not a problem when they paste it into the default text window, but it might happen that they paste it on the HTML-Tab. In this case the data is not encoded to valid html which would be
     
    &lt;!-- Test /&gt;
     
    (Same happens when they are in the default tab and select 'Paste as HTML')
     
    So technically it's correct from CuteEditor: It's pasted as HTML and accepted and saved. But later on I want to display the entered text, and thats the problem now: The browser (IE 6) stops with an error:
     
    Sys.ArgumentException: Value must not be null for Controls and Behaviors. Parameter name: element
     
    I tried to reproduce on your demo page but you only output the entered text in HTML-Code using HTMLEncode, so that's not a problem.
     
     
    So as said, it's not directly a problem of CuteEditor, but several others might have the same problem so I hope there is a solution, like checking whether HTMLCode is valid without disabling the HTML-Functionality completely because some other users really need that.
     
    Many thanks in advance!
     
    I wonder how it's done here in the forum because in the HTML-Code I added the above mentioned invalid code and at least the preview is still working fine....
    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
    Filed under:
  •  07-29-2009, 2:56 AM 54359 in reply to 54358

    Re: How to avoid illegal / invalid HTML Code


    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  07-29-2009, 10:11 AM 54366 in reply to 54359

    Re: How to avoid illegal / invalid HTML Code

    This <!-- Test /> works fine here.
     
    Which version of Cute Editor are you using?
     

    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

  •  07-30-2009, 1:31 AM 54392 in reply to 54366

    Re: How to avoid illegal / invalid HTML Code

    Hi Adam,
     
    I'm using latest version 6.4.
     
    And yes, as said, it's not a problem of CuteEditor. It saves the values correct. The problem appears later on when I try to display the entered text using a Label. This does not work as it's invalid HTML. I could not check whether the problem also appears in the demo, because when I save text in your demo it's only output is encoded, display the HTML (e.g. <b>Test</b> instead of interpreting it (e.g. Test). Encoding the text is not a problem but of course not what I want.
     
    But I wonder how it's done here in the forum because in my initial posting I added some invalid text as you could see in the screenshot of posting 2, and it's displayed fine. So there must be a solution for it, but I don't know how deep you are in the development of this forum?
     
    Best regards
    Kai

    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
  •  07-30-2009, 1:10 PM 54414 in reply to 54392

    Re: How to avoid illegal / invalid HTML Code

  •  07-31-2009, 1:40 AM 54423 in reply to 54414

    Re: How to avoid illegal / invalid HTML Code

    Hi Adam,
     
    the problem is repeatable there. I entered
     
    Testing <!-- Test />successfully
     
    on the HTML-Tab, and it only displays 'Testing' because of the following invalid HTML-Tag. But unfortunately my application crashes when using invalid HTML, while your demo still works fine.
     
     I've now checked whats the difference between your and my page. It seems that at least IE6 handles invalid tags depending on their position because your text is displayed in a table, and the next table cells are displayed normal again, so the invalid tag (or better: the still open comment-tag) only affects current table cell. So I will check my application now and try to find a 'safe' place for my label.
     
    Many thanks for your support!
     
    Best regards
    Kai
     

    .net Framework 4.0 / ASP.net / VB / CuteEditor 6.7 / SQL 2005
View as RSS news feed in XML