Interesting problem with java api

Last post 06-11-2007, 1:54 PM by DanC. 2 replies.
Sort Posts: Previous Next
  •  06-11-2007, 10:01 AM 30571

    Interesting problem with java api

    I have 2 editors on a form.  The 1st is normally hiddeen from the user.  It's inside a span tag with style="display:none".  It is used to hold the value of the editor prior to a user making changes to it.  If the user makes changes to the displayed editor, the new content is placed into the hidden editor (so I can detect another change).  When I call editor21.setHTML(editor2.getHTML()), the contents of the hidden editor(editor2) are not identical to editor 1, even though both editors have identical configurations(except their ID values).  In the examples shown, I have added a custom save button.

    Any idea what is happening here?  What seems to be happening is that formatted HTML ends up in the top editor eitehr added <p> tags or a space at the end of the inserted text.  I also noticed that after everything is completed in the script, the cursor is on the line following the text, where in the other editor it is on the line at the end of the inserted text.

    I can duplicate this issue with the following generic code

    <%@ Language=VBScript %>
    <!-- #include file="ce/CuteEditor_Files/include_CuteEditor.asp" -->
    <html>
    <head>
        <title>Untitled Page</title>
    </head>
    <body>
    <br />

        <%
        Set CurrentGenObsEditor = New CuteEditor
        CurrentGenObsEditor.ID = "CurrentGeneralObservations"
        CurrentGenObsEditor.Text = "test"
        CurrentGenObsEditor.FilesPath = "ce/CuteEditor_Files"
        CurrentGenObsEditor.EditorBodyStyle = "font:normal 12px arial;"
        CurrentGenObsEditor.EditorWysiwygModeCss = "main.css"
        CurrentGenObsEditor.AutoConfigure = "Full"
        CurrentGenObsEditor.Width = "100%"
        CurrentGenObsEditor.ThemeType = "Office2003_BlueTheme"
        CurrentGenObsEditor.Draw()
        Set CurrentGenObsEditor = Nothing
     
        Set GenObsEditor = New CuteEditor
        GenObsEditor.ID = "GeneralObservations"
        GenObsEditor.Text = "test"
        GenObsEditor.FilesPath = "ce/CuteEditor_Files"
        GenObsEditor.EditorBodyStyle = "font:normal 12px arial;"
        GenObsEditor.EditorWysiwygModeCss = "main.css"
        GenObsEditor.AutoConfigure = "Full"
        GenObsEditor.Width = "100%"
        GenObsEditor.ThemeType = "Office2003_BlueTheme"
        GenObsEditor.CustomAddons = "<img title=""Save Observations"" class=""CuteEditorButton""CuteEditor_ButtonCommandOver(this)""CuteEditor_ButtonCommandOut(this)""CuteEditor_ButtonCommandDown(this)""CuteEditor_ButtonCommandUp(this)""CuteEditor_CancelEvent()"" Command=""SaveObservations"" src=""ce/CuteEditor_Files/images/save.gif"" />"
        GenObsEditor.Draw()
        Set GenObsEditor = Nothing
        %>

        <script language="javascript">
       
        function CuteEditor_OnCommand(editor,command,ui,value) {
            //handle the command by yourself
            if (command == "SaveObservations") {
                editor1 = document.getElementById('CE_GeneralObservations_ID');
                editor2 = document.getElementById('CE_CurrentGeneralObservations_ID');
                sHTML = editor1.getHTML()
                editor2.setHTML(editor1.getHTML());
                alert(editor1.getHTML() == sHTML);
                alert(editor2.getHTML() == sHTML);
                return true;
                }
        }
       
        </script>
    </body>
    </html>

     

     










    Set CurrentGenObsEditor = New CuteEditor
    CurrentGenObsEditor.ID = "CurrentGeneralObservations"
    CurrentGenObsEditor.Text = "test"
    CurrentGenObsEditor.FilesPath = "ce/CuteEditor_Files"
    CurrentGenObsEditor.EditorBodyStyle = "font:normal 12px arial;"
    CurrentGenObsEditor.EditorWysiwygModeCss = "main.css"
    CurrentGenObsEditor.AutoConfigure = "Full"
    CurrentGenObsEditor.Width = "100%"
    CurrentGenObsEditor.ThemeType = "Office2003_BlueTheme"
    CurrentGenObsEditor.Draw()
    Set CurrentGenObsEditor = Nothing

    Set GenObsEditor = New CuteEditor
    GenObsEditor.ID = "GeneralObservations"
    GenObsEditor.Text = "test"
    GenObsEditor.FilesPath = "ce/CuteEditor_Files"
    GenObsEditor.EditorBodyStyle = "font:normal 12px arial;"
    GenObsEditor.EditorWysiwygModeCss = "main.css"
    GenObsEditor.AutoConfigure = "Full"
    GenObsEditor.Width = "100%"
    GenObsEditor.ThemeType = "Office2003_BlueTheme"
    GenObsEditor.CustomAddons = ""
    GenObsEditor.Draw()
    Set GenObsEditor = Nothing
    %>



    Filed under:
  •  06-11-2007, 1:33 PM 30584 in reply to 30571

    Re: Interesting problem with java api

    DanC,
     
    This example works fine here. Which browser 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

  •  06-11-2007, 1:54 PM 30586 in reply to 30584

    Re: Interesting problem with java api

    IE 6
     
    Are you sure it returns identical values?  Did you leave the alert boxes in the code that test the values?
View as RSS news feed in XML