Re: Select an image outside of Cute Editor?

  •  07-10-2007, 5:54 PM

    Re: Select an image outside of Cute Editor?

    The demo is great, and I have successfully adapted it for a site that needed to use the Image and File dialogs at times without showing the editor (Javascript code listed below). Using CuteEditor .NET 6 (.NET 1.1). It all works perfectly with IE7.
     
    However, that's as good as it gets. With Firefox 2.0.0.3 it displays the insert image dialog but when you select an image, it throws various errors (see below) and doesn't return to the calling script.
     
    With Opera 9.2 it doesn't even show the dialog, nor on the Mac. See below for Opera error.
     
    I suspect the problems have to do with the way the editor is rendered in each browser, but don't know how to resolve this. Can anyone help, please?
     
    Paul
     
     
    Firefox Errors
    Error: obj has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/CuteSoft_Client/CuteEditor/Dialogs/Load.ashx?type=dialogscript&file=Dialog_InsertGallery.js
    Line: 1
     
    Error: cell.all has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/BackOffice/UpdateShop.aspx
    Line: 38
     
    Error: cell.all has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/BackOffice/UpdateShop.aspx
    Line: 38
     
    Error: editdoc has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/CuteSoft_Client/CuteEditor/Dialogs/Load.ashx?type=dialogscript&file=Dialog_InsertGallery.js
    Line: 1
     
    Opera Error
    Event thread: click
    Error:
    name: TypeError
    message: Statement on line 5: Type mismatch (usually a non-object value used where an object is required)
    Backtrace:
      Line 5 of linked script http://etrader.lab.dotcomsoftwaresolutions.co.uk/Script/Resource.js
        editor.FocusDocument();
      Line 1 of  script
        callInsertImage("CE_editLogo_ID", "hidLogo");
      At unknown location
        [statement source code not available]
     
    Javascript Code
    function callInsertImage(editorClientId, targetControl)
    {
       var editor = document.getElementById(editorClientId);
       editor.FocusDocument();
       var editdoc = editor.GetDocument(); 
       editor.ExecCommand('new');
       editor.ExecCommand('ImageGalleryByBrowsing');
       InputURL(editorClientId, targetControl);
    }
    function InputURL(editorClientId, targetControl)

       var editor = document.getElementById(editorClientId);
       var editdoc = editor.GetDocument();
       var imgs = editdoc.getElementsByTagName("img");
       if(imgs.length>0) 
       {
          var filename = imgs[imgs.length-1].src;
          document.getElementById(targetControl).value = filename;
       }
       else
       {
          document.getElementById(targetControl).value = "";
       } 
       document.forms["Form1"].submit();
    }

    Paul Taylor
    Dotcom Software Solutions
    Filed under:
View Complete Thread