No More JavaScript API in 6.0??

Last post 05-15-2007, 12:52 PM by lbklatzkin. 2 replies.
Sort Posts: Previous Next
  •  05-08-2007, 11:22 AM 29357

    No More JavaScript API in 6.0??

    I just installed 6.0 in our test environment today and I am receiving a JavaScript error that obj_Editor1 is not defined.  For the install, I:
     
    Renamed the old CuteEdit_Files folder on the server.
    Uploaded entire CuteEdit_Files folder from the new build.
     
    The Editor works fine, but my form posts the content using JavaScript :
     
    var editor1 = obj_Editor1;
    frm.Message_Body.value = editor1.getHTML();
     
    frm.submit();
     
    Exact JavaScript Error:
     
    Error: obj_Editor1 is undefined
    Line: 440
     
    I'm sure there is a quick fix, so please reply soon.
     
    Thank you,
     
    Max
  •  05-08-2007, 11:34 AM 29358 in reply to 29357

    Re: No More JavaScript API in 6.0??

    max,
     
    Please use the new JavaScript API.
     
      <script type="text/javascript" >
       function getHTML()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=editor.ClientID%>');
        
        // Get the editor HTML
        document.getElementById("myTextArea").value = editor1.getHTML();
       }  
       
       function setHTML()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=editor.ClientID%>');
        
        // Set the editor 
        editor1.setHTML(document.getElementById("myTextArea").value);
       }
       
       
       function PasteHTML(html)
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=editor.ClientID%>');
        
        editor1.PasteHTML(html);
       }
       
       function SetActiveTab(tab)
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=editor.ClientID%>');
        
        editor1.SetActiveTab(tab);
       }
       
       
       function setFocus()
       {
        // get the cute editor instance
        var editor1 = document.getElementById('<%=editor.ClientID%>');
        
        editor1.FocusDocument();
       }
      </script>

    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

  •  05-15-2007, 12:52 PM 29683 in reply to 29358

    Re: No More JavaScript API in 6.0??

    i've been using a popup window to populate my content in the textarea of the Editor.  So you can use the <%=editor.ClientID%>, but it doesn't help you if you're trying to access the CuteEditor from another page (or popup window).  So  you can still use the javascript API, but instead of using :
     
    var editor1 = obj_Editor1;
     
    use
     
    var editor1 = CE_Editor1_ID;
     
     
    Example for my situation:
     
    Old version (5.2) was:
    window.opener.obj_Editor1.editdoc.body.innerHTML = txt; 
     
    New version (6.0) is:
    window.opener.CE_Editor1_ID.setHTML(txt);

     
     
    rock on... love 6.0!!
View as RSS news feed in XML