Cannot validate contents of hidden CuteEditors

Last post 10-08-2010, 4:43 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  10-07-2010, 3:43 PM 64354

    Cannot validate contents of hidden CuteEditors

    I am trying to integrate CuteEditor 6.6 into an existing page where it will be replacing another rich text editor control.  The page dynamically creates 6 instances of the editor and places each one in a tab within another vendor's tabbed interface control.  Each tab renders its contents within a single-cell table that is hidden/unhidden via the "display:none" attribute.
     
    Each editor has a required-text validator (from yet another vendor) assigned to it to ensure that all editors contain text.  The problem I'm encountering is that the validators are flagging editors as not containing text if those editors are on tabs that have not been selected.  If I click on each tab (and hence make each editor visible at least once) before submitting the page, the validation errors do not occur.
     
    After reading this post (http://www.cutesoft.net/forums/thread/42058.aspx) I tried implementing that solution, where I call CuteEditorInitialize for each editor on page load, but it had no effect.  It seems that the editors are not initialized until they (or their parent controls) are made visible.  This was made apparent when I tried to implement a custom client-side validation function which attempted to call the editor's getHTML() function.  It worked only for the editors that had been made visible by selecting their tabs -- the others caused the "Object doesn't support this method or function" js error.
     
    I have the source for the 3rd party tab control, and I tried changing that to render the tabs as divs instead of tables (didn't help).  Based on advice in other posts here, I also tried changing the display:none settings to visibility:hidden, and while  that made the editor invisible it still took the same amount of space on the page.
     
    I would greatly appreciate any assistance.
     
    Thanks-
    John
  •  10-08-2010, 4:43 AM 64356 in reply to 64354

    Re: Cannot validate contents of hidden CuteEditors

    Hi JPenn,
     
    If you want to replace the tab part with div, please try the example below. You still can get the content of editor if use "
    visibility: hidden".
     
    1. <%@ Page Language="C#" %>  
    2.   
    3. <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5. <html xmlns="http://www.w3.org/1999/xhtml">  
    6. <head runat="server">  
    7.     <title>example</title>  
    8.   
    9.     <script runat="server">  
    10.         protected override void OnLoad(EventArgs e)  
    11.         {  
    12.             editor1.Text = "Is editor1";  
    13.             editor2.Text = "Is editor2";  
    14.             base.OnLoad(e);  
    15.         }  
    16.     </script>  
    17.   
    18. </head>  
    19. <body>  
    20.     <form id="theForm" runat="server">  
    21.     <div id="div1" style="visibility: hidden">  
    22.         <CE:Editor ID="editor1" runat="server">  
    23.         </CE:Editor>  
    24.     </div>  
    25.     <div id="div2">  
    26.         <CE:Editor ID="editor2" runat="server">  
    27.         </CE:Editor>  
    28.     </div>  
    29.     <input type="button" value="GetEditor1Content" onclick="getEditor1Content()" />  
    30.     <input type="button" value="GetEditor2Content" onclick="getEditor2Content()" />  
    31.     </form>  
    32. </body>  
    33. </html>  
    34.   
    35. <script>  
    36. function getEditor1Content()  
    37. {  
    38.     var editor1=document.getElementById("<%= editor1.ClientID %>");  
    39.     alert(editor1.getHTML());  
    40. }  
    41. function getEditor2Content()  
    42. {  
    43.     var editor2=document.getElementById("<%= editor2.ClientID %>");  
    44.     alert(editor2.getHTML());  
    45. }  
    46. </script> 
     
    Regards,
     
    ken
View as RSS news feed in XML