locked
Javascript error on Rich Text Editor of CEWP RRS feed

  • Question

  • Hi all,

    I have a problem that is really bugging and I wasn't able to find any workaround all day. I'll try to give as many details as possible:

    I'm maintaining several site collections on a single server and this problem occurs only on one of the site collections. However it occurs on all subsites of this collection, it occurs on old pages and newly created pages, even on pages containing only one empty CEWP.

    When I'm pressing the button for Rich Text Editor of CEWP I get the following error:

    Message: Invalid argument.
    Line: 5740
    Char: 2
    Code: 0
    URI: http://www.dyrlaegeankenaevn.dk/_layouts/1030/HtmlEditor.js

    I've tracked down the error with IE developer tools and I found that the error pops up in HtmlEditor.js at

    function RTE2_GenerateLaunchArguments(parameterArray, webUrl, containerID)
    {
        ............some code goes here......................
        elem=document.getElementById(containerID);
        ............some code goes here......................
    }

    I followed containerID down the stack and it comes from:

    function WP_LaunchAlternativeRichTextEditor(args)
    {
        ............some code goes here......................
        var dialogArguments=RTE2_GenerateLaunchArguments(params, args.webUrl, args.webPart.DOMObject.id);
        ............some code goes here......................
    }

    Again I followed down the args object and it actually comes from my aspx page:

    <script type="text/javascript" >
    //<![CDATA[

    function WP_DetectAndLaunchEditor()
    {
        var args = new Object();
        args.hiddenField = document.getElementById('MsoContentToolpartBasicContentProperty' );

        args.webPart = varPartWPQ1;

        args.lcid = 1030;
        args.webUrl = '\u002f' ;
        args.existAlternativeRichTextEditor = 'True' ;
        WP_SetHtml(args);

        if (args.existAlternativeRichTextEditor == 'False'
          || typeof WP_LaunchAlternativeRichTextEditor == 'undefined' )
        {
             WP_LaunchStandardRichTextEditor(args);
        }
       else
       {
             WP_LaunchAlternativeRichTextEditor(args);
       }
    }

    You can see that the args.webPart is actually varPartWPQ1 which is created on the same page:
    <script language="JavaScript" >
    <!--

    WPSC.Init(document);

    var varPartWPQ1 = WPSC.WebPartPage.Parts.Register('WPQ1' ,'3a30f0ee-15ff-4aaa-9827-a064b1d089b7' ,document.all.item('WebPartWPQ1' ));

    WPSC.WebPartPage.WebURL = 'http:sitename goes here.dk' ;
    WPSC.WebPartPage.WebServerRelativeURL = '\u002f' ;

    //-->
    </script>

    Now the really ugly part is that after all this debugging I find that document.all.item('WebPartWPQ1') is indeed returning an object, BUT the DOMObject.id of this object is a bloody empty string!!!!!! The element itself appears to be just fine:

    <div class="ms-WPBody" id="WebPartWPQ1" width="100%" HasPers="false" WebPartID="3a30f0ee-15ff-4aaa-9827-a064b1d089b7" SelectedWebPart="true">

    It's just that document.all.item('WebPartWPQ1') doesn't get its id.

    Please help me fix this!!! Our client isn't that versed with HTML and he really prefers the Rich Text Editor. Oh yeah, the HTML Source Editor opens just fine, this only happens with the Rich Text Editor.

    Any ideas will be greatly appreciated!
    • Edited by Alex F. Lazar Thursday, February 4, 2010 3:38 PM code formatting
    Wednesday, February 3, 2010 4:31 PM

Answers

  • This could be browser issues as well. The same happened with me: Rich Text Editor control was opening fine on IE6 but not on IE7 and 8.
    You may try the following steps
    1) Go to Tools -> Options -> Security
    2) Add the respective site in Local intranet zone.
    3) Refresh the page and retry. :)

    It worked for me like a magic.. Hope, you'll also get it going..
    • Marked as answer by Alex F. Lazar Friday, February 5, 2010 10:12 AM
    Friday, February 5, 2010 9:00 AM

All replies

  • This could be browser issues as well. The same happened with me: Rich Text Editor control was opening fine on IE6 but not on IE7 and 8.
    You may try the following steps
    1) Go to Tools -> Options -> Security
    2) Add the respective site in Local intranet zone.
    3) Refresh the page and retry. :)

    It worked for me like a magic.. Hope, you'll also get it going..
    • Marked as answer by Alex F. Lazar Friday, February 5, 2010 10:12 AM
    Friday, February 5, 2010 9:00 AM
  • Magic indeed, because it makes no sense, but it absolutely works!

    Thank you very much, kam21!

    Now all I have to do is write a guide for the client on how to add the web site to the local intranet zone.

    Best regards!
    Friday, February 5, 2010 10:12 AM
  • I had the problems for days and truly your solution worked nlike magic. Tons of Thanks
    Thursday, August 26, 2010 7:36 AM
  • Hello all there,

    I know that some of you managed to fix that problem, by going through the steps proposed by our friend Kam21. However my case was different, where after some crazy episodes of trying to resolve the problem, it appeared that i have to mark the compatability option under the browser : Tools --> Compatability View Settings.

    Long live IE , i wonder how messy it is going to be after launching IE 9 .

    • Proposed as answer by jeremystewart Friday, January 28, 2011 10:00 PM
    • Unproposed as answer by Mike Walsh FIN Friday, January 28, 2011 10:44 PM
    Wednesday, October 13, 2010 2:19 PM
  • I know that some of you managed to fix that problem, by going through the steps proposed by our friend Kam21. 
    I too was experiencing this issue with the site already added to the Tools > Internet Options > Security > Local Intranet > Sites > Advanced zone. We do not have other language packs installed in the farm, so only one instance of HtmlEditor.js existed. Also, the issue didn't appear across all sites which made it tougher to track down: team sites had no issue, but publishing sites showed the error. After much research, changing IE8 to use the Compatibility View fixed the problem...at least for now!
    • Edited by Mike Walsh FIN Friday, January 28, 2011 10:45 PM do not waste screen space by using full quote
    Friday, January 28, 2011 10:05 PM