Java script problem while using Asp:Wizard Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • steve waugh
    New Member
    • Oct 2007
    • 13

    Java script problem while using Asp:Wizard Control

    I've got two cute editor controls each in a different WIZARD step. My javascript seems to be working from the first step and javascript events firing but when I go to the second step (containing a second editor) and then go back to the first step I find that the OnInitialized and OnChange events are no longer firing for the first editor.

    I had assumed that these events would always fire for any cute editors on a page?

    Thx in advance
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by steve waugh
    I've got two cute editor controls each in a different WIZARD step. My javascript seems to be working from the first step and javascript events firing but when I go to the second step (containing a second editor) and then go back to the first step I find that the OnInitialized and OnChange events are no longer firing for the first editor.

    I had assumed that these events would always fire for any cute editors on a page?

    Thx in advance

    Java != Javascript
    Moved to Javascript forum.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Can you post some code that we can look at?

      Comment

      • T0mm0
        New Member
        • Oct 2007
        • 12

        #4
        I'm having the same problem. Here's some code... the OnChanged event fires only when viewing Editor1 for the first time only... doesn't fire for Editor2 at all...

        [HTML]<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="Test. aspx.vb" Inherits="Test" %>

        <%@ Register Assembly="CuteE ditor" Namespace="Cute Editor" TagPrefix="CE" %>

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

        <html xmlns="http://www.w3.org/1999/xhtml" >
        <head runat="server">
        <title>Untitl ed Page</title>
        </head>
        <body>
        <form runat="server">
        <asp:Wizard ID="Wizard1" runat="server">
        <WizardSteps>
        <asp:WizardSt ep ID="WizardStep1 " runat="server" Title="Step 1">
        <CE:Editor ID="Editor1" runat="server">
        </CE:Editor>
        </asp:WizardStep>
        <asp:WizardSt ep ID="WizardStep2 " runat="server" Title="Step 2">
        <CE:Editor ID="Editor2" runat="server">
        </CE:Editor>
        </asp:WizardStep>
        </WizardSteps>
        </asp:Wizard>
        </form>
        </body>
        <script type="text/javascript" language="javas cript">
        [/HTML][CODE=javascript]var editor1 = document.getEle mentById('<%= Editor1.ClientI D%>');
        var oldColour = editor1.style.b orderColor;

        function CuteEditor_OnCh ange(editor)
        {
        var editdoc = editor.GetDocum ent();
        alert(editdoc.b ody.scrollWidth >800)
        if(editdoc.body .scrollWidth>80 0)
        {
        editor1.style.b orderWidth=3;
        editor1.style.b orderColor="#FF 0000";
        }
        else
        {
        editor1.style.b orderColor=oldC olour;
        }
        }
        </script>
        </html>[/CODE]
        Last edited by acoder; Nov 7 '07, 07:55 AM. Reason: Added code tags

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          You're not referring to Editor2 in your code. You've used the global variable editor1 within the function.

          Comment

          • T0mm0
            New Member
            • Oct 2007
            • 12

            #6
            To simplify my code... see below. OnInitialized and OnChanged events fire only on the first initialization and viewing of Editor1. They never fire for Editor2 or for subsequent changes on Editor1 after having gone to wizardstep2.

            Code:
            <script type="text/javascript" language="javascript">
            
            function CuteEditor_OnChange(editor)
            { 
            alert("OnChange")
            }
            
            function CuteEditor_OnInitialized(editor)
            {
            alert("OnInitialized")
            }
            </script>

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #7
              Can you show the client-side code (how it turns out in the browser) for Editor2?

              Comment

              • T0mm0
                New Member
                • Oct 2007
                • 12

                #8
                They're quite long... too long that it's not letting me post it... let me think of another way to put it up

                Comment

                • T0mm0
                  New Member
                  • Oct 2007
                  • 12

                  #9
                  view source on each of these...

                  Wizard Step 1

                  Wizard Step 2

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    The second link doesn't work.

                    I noticed that the code includes a script:[HTML]<script src="/ShoptalkProduct ion/CuteSoft_Client/CuteEditor/Load.ashx?type= scripts&amp;fil e=IE_Loader">[/HTML] This may contain the code which attaches the initialize and change events.

                    Comment

                    Working...