Can't attach event

Last post 09-29-2006, 9:42 AM by vtraag. 3 replies.
Sort Posts: Previous Next
  •  09-28-2006, 5:50 AM 23140

    Can't attach event

    Hi,
     
    I've tried the code as presented in your Javascript-API example files. My editor is called Editor:
     
    If I try to get the document with the following line of code:
     
    var objDoc = obj_Editor.GetDocument();
     
    I get an error that GetDocument() is undefined.
     
    The reason I want to load this is to attach to an event. I've also tried the following options (gotten by debugging and trying)
     
      obj_Editor.editdoc.attachEvent('onkeypress', Changed, true);
      obj_Editor.editwin.attachEvent('onkeypress', Changed, true);
      obj_Editor.textarea.attachEvent('onkeypress', Changed, true);
      obj_Editor._frame.attachEvent('onkeypress', Changed, true); 
     
    but none of the above options work.
     
    Regards
     
    Vincent Traag
  •  09-28-2006, 1:12 PM 23164 in reply to 23140

    Re: Can't attach event

    Vincent,
     
    >>My editor is called Editor:
     
    Does it mean you set yout editor ID as "Editor"? Can you post the whole configuration code?
     
    Adam
     
     
     

    Getting the CuteEditor Instance


    In order to find the active editor, you would type: 

    // get the cute editor instance. In the following example, I assume your editor ID is : Editor1

    var editor1 = obj_Editor1

    Getting the Active Editor Document


    In order to find the active editor document, you would type:

    // get the active editor document

    var editdoc = editor1.GetDocument();

    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

  •  09-29-2006, 9:22 AM 23202 in reply to 23164

    Re: Can't attach event

    Hi Adam,
     
    My source code in an ASP page is:
    editor.ID = editorName
    editor.Text = MessageField
    editor.FilesPath = "../CuteEditor_Files"
    editor.CustomCulture = editor_Culture
    editor.AllowUpload = editor_AllowUpload
    editor.ImageGalleryPath = editor_ImageGalleryPath
    editor.FlashGalleryPath = editor_FlashGalleryPath
    editor.MediaGalleryPath = editor_MediaGalleryPath
    editor.FilesGalleryPath = editor_FilesGalleryPath
    editor.MaxImageSize = editor_MaxImageSize
    editor.MaxDocumentSize = editor_MaxImageSize
    editor.MaxFlashSize = editor_MaxFlashSize
    editor.Width = editor_Width
    editor.Height = editor_Height
    editor.RemoveServerNamesFromUrl = true
    editor.UseRelativeLinks = false
    editor.UsePhysicalFormattingTags = true
    editor.EnableAntiSpamEmailEncoder = true
    editor.EditorBodyStyle = "font:normal 12px arial;"
    editor.ConfigurationPath = "../CuteEditor_Files/Configuration/AutoConfigure/Full_noform.config"
    editor.EditorWysiwygModeCss = "../CuteEditor_Files/example.css"
    editor.EditorWysiwygModeCss = ""
    editor.BreakElement = "Br"
    editor.ThemeType = "Office2003"
    ' Editor.TextAreaStyle = "background-image:{url:\images\asp.jpg};"
    editor.Draw()
    After this, I read from the documentation that the javascript variable should be available as 'obj_' + editorName
     
    So, then I would like to attach to onkeypress:
    Response.Write("<script language=""javascript"" type=""text/javascript"">" & vbCrLf)
    Response.Write("var editDoc = obj_" & editorName & ".GetDocument()" & vbCrLf)
    Response.Write("editDoc.attachEvent('onkeypress', Changed, true);" & vbCrLf)
    Response.Write("</script>" & vbCrLf)
    I get an error at the GetDocument() method. As I've stated in my previous post, alternative methods also don't do the trick.
     
    Vincent
  •  09-29-2006, 9:42 AM 23203 in reply to 23202

    Re: Can't attach event

    I just see I've missed the ';' in the line with the .GetDocument() method. Of course, that's incorrect, and it should read:
    Response.Write("var editDoc = obj_" & editorName & ".GetDocument();" & vbCrLf)
     
     
View as RSS news feed in XML