This is a migrated thread and some comments may be shown as answers.

Script controls may not be registered before PreRender error

5 Answers 115 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
M V
Top achievements
Rank 1
M V asked on 06 Oct 2009, 04:00 PM
Hi,

We are using RAD editor to display multi line data in the custom list forms of our MOSS 2007 sites. It works fine in certain cases but fails in a few of them (especially in the new and the edit forms) with the script controls prerender error message. Could you please let me know what could be causing this issue to happen?

Appreciate an early response on the same.

Thanks

5 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 08 Oct 2009, 11:54 AM
Hello M V,

I apologize  for the late response. We are preparing for the new release of the beta of 2009.Q3.

Regarding the issue, in order to help you further I will need the following information.
1. What version of RadEidtor for MOSS you are using?
2. I will need the configuration files which are located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder (ConfigFile.xml, ListConfigFile.xml, ToolsFile.xml, ListToolsFile.xml, MOSSEditorTools.js).
3. A step by step scenario of how to reproduce the issue.

All of this will help me to reproduce the problem on our test server.

Thank you.


All the best,
Stanimir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
M V
Top achievements
Rank 1
answered on 09 Oct 2009, 04:40 PM

Hi Stanimir,

Thank you getting back.

The version that is being used is 5.2.0

To reproduce the issue
*********************************
Customize either the new or the edit form of a list using the custom list form which have columns of type multi line (multiple lines of text). When these forms (new or edit) are loaded with out the RAD tool feature being activated the page loads fine and the contents are displayed fine, but when the RAD tool feature (use RADEditor to edit list items site feature) is activated, then the Prerender error is thrown (screen shot attached)

Please find the contents of the config files that you had asked for

Configfile.xml

********************

<?xml version="1.0" encoding="utf-8" ?>

<!-- ==============================================================================================

            Config File valid structure:

            <configuration>

    <property>...</property>

    ...

                        <property>

                                    <item>...</item>

                                    <item>...</item>

                                    ...

                        </property>

                        ...

            </configuration>

=============================================================================================== -->

<configuration>

  <property name="AllowThumbGeneration">True</property>

  <property name="ConvertToXhtml">True</property>

  <property name="EnableDocking">False</property>

  <property name="ShowHtmlMode">True</property>

  <property name="ShowPreviewMode">False</property>

  <property name="ToolbarMode">ShowOnFocus</property>

  <property name="ToolsWidth">800px</property>

  <property name="Skin">Telerik</property>

</configuration>

 

ListConfig.xml

<?xml version="1.0" encoding="utf-8" ?>

<!-- ==============================================================================================

            Config File valid structure:

            <configuration>

    <property>...</property>

    ...

                        <property>

                                    <item>...</item>

                                    <item>...</item>

                                    ...

                        </property>

                        ...

            </configuration>

=============================================================================================== -->

<configuration>

  <property name="ConvertToXhtml">true</property>

  <property name="EnableDocking">False</property>

  <property name="ShowPreviewMode">False</property>

  <property name="Height">240px</property>

  <property name="Width">500px</property>

  <property name="Skin">Telerik</property>

</configuration>

 

ListToolsFile.xml

<root>

            <tools name="EnhancedToolbar">

                        <tool name="Cut" shortcut="CTRL+X" />

                        <tool name="Copy" shortcut="CTRL+C" />

                        <tool name="Paste" shortcut="CTRL+V" />

                        <tool name="PasteFromWord" />

                        <tool name="PasteFromWordNoFontsNoSizes" />

                        <tool name="PastePlainText" />

                        <tool name="PasteAsHtml"  />

 

                        <tool name="FormatStripper" />

                        <tool separator="true" />

                        <tool name="Undo" shortcut="CTRL+Z"/>

                        <tool name="Redo" shortcut="CTRL+Y"/>

                        <tool separator="true" />

                        <tool name="MOSSInsertTable" />

                        <tool name="MOSSInsertTableElement">

                                    <tool name="InsertRowAbove" />

                                    <tool name="InsertRowBelow" />

                                    <tool name="InsertColumnLeft" />

                                    <tool name="InsertColumnRight" />

                        </tool>

                        <tool name="MOSSDeleteTableElement">

                                    <tool name="DeleteRow" />

                                    <tool name="DeleteColumn" />

                        </tool>

                        <tool name="SplitCell" />

                        <tool name="MergeColumns" />

                        <tool separator="true" />

                        <tool name="MOSSLinkManager" />

                        <tool name="ImageManager" />

                        <tool name="DocumentManager" />

                       

<tool name="DocumentManager" />

                        <tool separator="true" />

                        <tool name="Zoom" />

                        <tool name="AjaxSpellCheck" />

                        <tool name="FindAndReplace" />

                        <tool name="Print" shortcut="CTRL+P"/>

                        <tool name="ToggleScreenMode" shortcut="F11"/>

 

            </tools>

  <tools name="BasicToolbar">

    <tool name="FontName" />

    <tool name="FontSize" />

    <tool separator="true" />

    <tool name="Bold" shortcut="CTRL+B" />

    <tool name="Italic" shortcut="CTRL+I" />

    <tool name="Underline" shortcut="CTRL+U" />

    <tool separator="true" />

    <tool name="JustifyLeft" shortcut="CTRL+L" />

    <tool name="JustifyCenter" shortcut="CTRL+E" />

    <tool name="JustifyRight" shortcut="CTRL+R" />

    <tool separator="true" />

    <tool name="InsertOrderedList" />

    <tool name="InsertUnorderedList" />

    <tool name="Indent" />

    <tool name="Outdent" shortcut="CTRL+M" />

    <tool separator="true" />

    <tool name="ForeColor" />

    <tool name="BackColor" />

    <tool separator="true" />

    <tool name="MOSSLeftToRight" />

    <tool name="MOSSRightToLeft" />

  </tools>

  <contextMenus>

    <contextMenu forElement="*">

      <tool name="Cut"/>

      <tool name="Copy"/>

      <tool name="Paste"/>

    </contextMenu>

  </contextMenus>

</root>

 


 

ToolsFile.xml

<root>

  <modules>

    <module name="RadEditorDomInspector" />

  </modules>

  <tools name="MossTools1">

    <tool name="AjaxSpellCheck" />

    <tool name="FindAndReplace" />

    <tool separator="true" />

    <tool name="Cut" shortcut="CTRL+X" />

    <tool name="Copy" shortcut="CTRL+C" />

    <tool name="Paste" shortcut="CTRL+V" />

    <tool separator="true" />

    <tool name="Undo" shortcut="CTRL+Z" />

    <tool name="Redo" shortcut="CTRL+Y" />

    <tool separator="true" />

    <tool name="MOSSLinkManager" shortcut="CTRL+K" />

    <tool name="Unlink" shortcut="CTRL+SHIFT+K" />

    <tool name="ImageManager" shortcut="CTRL+G" />

    <tool name="MOSSTemplateManager" />

    <tool separator="true" />

    <tool name="MOSSInsertTable" />

    <tool name="SetTableProperties" />

    <tool name="ToggleTableBorder" />

    <tool separator="true" />

    <tool name="MOSSInsertTableElement">

      <tool name="InsertRowAbove" />

      <tool name="InsertRowBelow" />

      <tool name="InsertColumnLeft" />

      <tool name="InsertColumnRight" />

      <tool name="DeleteRow" />

      <tool name="DeleteColumn" />

      <tool name="SplitCell" />

    </tool>

    <tool name="MergeColumns" />

    <tool separator="true" />

    <tool name="ToggleSource" />

    <tool name="FormatStripper" />

    <tool separator="true" />

    <tool name="MOSSRightToLeft" />

    <tool name="MOSSLeftToRight" />

    <tool separator="true" />

    <tool name="ForeColor" />

    <tool name="BackColor" />

  </tools>

  <tools name="MossTools2">

    <tool name="ApplyClass" />

    <tool name="FormatBlock" />

    <tool separator="true" />

    <tool name="FontName" />

    <tool name="FontSize" />

    <tool separator="true" />

    <tool name="Bold" shortcut="CTRL+B" />

    <tool name="Italic" shortcut="CTRL+I" />

    <tool name="Underline" shortcut="CTRL+U" />

    <tool separator="true" />

    <tool name="JustifyLeft" />

    <tool name="JustifyCenter" />

    <tool name="JustifyRight" />

    <tool separator="true" />

    <tool name="InsertOrderedList" />

    <tool name="InsertUnorderedList" />

    <tool separator="true" />

    <tool name="Indent" />

    <tool name="Outdent" />

  </tools>

  <contextMenus>

    <contextMenu forElement="*">

      <tool name="Cut"/>

      <tool name="Copy"/>

      <tool name="Paste"/>

    </contextMenu>

  </contextMenus>

</root>


 

MOSSEditorTools.js

var RadE_HasRules = false;

Type.registerNamespace("Telerik.Web.UI.Editor");

if (typeof(Telerik.Web.UI.Editor.CommandList) == "undefined")

    Telerik.Web.UI.Editor.CommandList = {};

 

Telerik.Web.UI.Editor.CommandList["MOSSRightToLeft"] = function(commandName, editor, args)

{

            Telerk_MOSS_SetDirectionOfSelection(editor, "rtl");

};

Telerik.Web.UI.Editor.CommandList["MOSSLeftToRight"] = function(commandName, editor, args)

{

            Telerk_MOSS_SetDirectionOfSelection(editor, "ltr");

};

Telerik.Web.UI.Editor.CommandList["MOSSHelp"] = function(commandName, editor, args)

{

            HelpWindowKey('WCMHTMLEditor');

};

Telerik.Web.UI.Editor.CommandList["ToggleSource"] = function(commandName, editor, args)

{

            //todo: call the source dialog as the MOSS editor does

            editor.set_mode(Telerik.Web.UI.EditModes.Html);

};

Telerik.Web.UI.Editor.CommandList["MOSSInsertTable"] = function(commandName, editor, args)

{

            //todo: change the dialog to use the moss default (after firefox is fixed)

            editor.fire("TableWizard", args);

};

Telerik.Web.UI.Editor.CommandList["MOSSImageManager"] = function(commandName, editor, args)

{

            var params = editor._dialogParameters;

            var docEditor = editor.get_document();

            var configObj=new AssetPickerConfig("");

            configObj.ClientID=editor.get_id();

            configObj.DefaultAssetLocation="";

            configObj.DefaultAssetImageLocation="";

            configObj.CurrentWebBaseUrl=params["CurrentWebBaseUrl"];

            configObj.ManageHyperlink=false;

            configObj.AllowExternalUrls=params["AllowExternalUrls"];

            var bInserting=false;

            var elemToReplace=null;

            var imageAssetObj=new ImageAsset("");

 

            elemToReplace=editor.getSelectedElement();

            if (elemToReplace && elemToReplace.tagName && elemToReplace.tagName.toUpperCase() == "BODY")

            {

                        //if there is no selection or selection is the whole content body

                        elemToReplace = null;

            }

            var elemImage=FormJSRTE_GetNearestContainingParentElementOfTypes(editor.get_contentWindow().frameElement.id, elemToReplace, new Array("IMG"));

            if(!elemImage)

            {

                        bInserting=true;

                        elemImage=docEditor.createElement("IMG");

                        elemImage.border=0;

            }

            configObj.ReturnCallback=function(newAssetUrl, newAssetText, currentConfig, dialogReturnedData)

            {

                        if (dialogReturnedData)

                        {

                                    if (bInserting)

                                    {

                                                var tempDiv = docEditor.createElement("DIV");

                                                tempDiv.appendChild(elemImage);

                                                editor.pasteHtml(tempDiv.innerHTML,commandName);

                                                tempDiv = null;

                                    }

                        }

            }

            var dialogReturnedData=imageAssetObj.LaunchModalDialogOnElement(configObj, elemImage, true, !bInserting );

};

Telerik.Web.UI.Editor.CommandList["MOSSLinkManager"] = function(commandName, editor, args)

{

            var params = editor._dialogParameters;

            var docEditor = editor.get_document();

            var configObj=new AssetPickerConfig("");

            configObj.ClientID=editor.get_id();

            configObj.DefaultAssetLocation="";

            configObj.DefaultAssetImageLocation="";

            configObj.CurrentWebBaseUrl=params["CurrentWebBaseUrl"];

            configObj.AllowExternalUrls=params["AllowExternalUrls"];

            var bInserting=false;

            var elemToReplace=null;

            var linkAsset=new LinkAsset("");

            var innerLinkHTML=null;

            linkAsset.ManageLinkDisplayText=false;

            var elemLink=FormJSRTE_GetNearestContainingParentElementOfTypes(editor.get_contentWindow().frameElement.id, editor.getSelectedElement(), new Array("A"));

            if(!elemLink)

            {

                        bInserting=true;

                        elemLink=docEditor.createElement("A");

                        if (elemLink==null) return;

                        var editorSelection = editor.getSelection();

                        if (editorSelection.isControl())

                        {

                                    elemToReplace=editor.getSelectedElement();

                        }

                        else

                        {

                                    innerLinkHTML = editorSelection.getHtml();

                        }

            }

            else

            {

                        innerLinkHTML=elemLink.innerHTML;

            }

            configObj.ReturnCallback=function(newAssetUrl, newAssetText, currentConfig, dialogReturnedData)

            {

                        if (dialogReturnedData)

                        {

                                    var linkText = "";

                                    if ($telerik.isIE)

                                                linkText = elemLink.innerText;

                                    else

                                                linkText = elemLink.textContent;

                                    if(innerLinkHTML && innerLinkHTML != "")

                                    {

                                                elemLink.innerHTML=innerLinkHTML;

                                    }

                                    else if(linkText == "")

                                    {

                                                if(linkAsset.AssetText && linkAsset.AssetText !="")

                                                {

                                                            linkText=linkAsset.AssetText;

                                                }

                                                else

                                                {

                                                            linkText=linkAsset.AssetUrl;

                                                }

                                                elemLink.innerHTML += linkText;

                                    }

                                    if (elemToReplace !=null)

                                    {

                                        var parentEl = elemToReplace.parentNode;

                                                elemLink.innerHTML="";

                                                parentEl.insertBefore(elemLink, elemToReplace);

                                                elemLink.appendChild(elemToReplace);

                                                linkAsset.FixupIconsAndEmptyAnchors(elemLink);

                                                return;

                                    }

                                    else if (bInserting)

                                    {

                                                var selection=docEditor.selection;

                                                if (selection !=null)

                                                {

                                                            var textRange=selection.createRange();

                                                            if (textRange !=null)

                                                            {

                                                                        var text=textRange.text;

                                                                        if (text && text !="" && !text.match(/^\s+$/))

                                                                        {

                                                                                    textRange.execCommand("Unlink");

                                                                                    elemLink.innerHTML=textRange.htmlText;

                                                                                    linkAsset.FixupIconsAndEmptyAnchors(elemLink);

                                                                        }

                                                                        var tempDiv = docEditor.createElement("DIV");

                                                                        tempDiv.appendChild(elemLink);

                                                                        textRange.pasteHTML(tempDiv.innerHTML);

                                                            }

                                                }

                                                else

                                                {

                                                            //if we cannot get the selection, use the editor paste function instead

                                                            var tempDiv = docEditor.createElement("DIV");

                                                            tempDiv.appendChild(elemLink);

                                                            editor.pasteHtml(tempDiv.innerHTML, commandName);

                                                            tempDiv = null;

                                                }

                                    }

                                    else

                                    {

                                                linkAsset.FixupIconsAndEmptyAnchors(elemLink);

                                    }

                        }

            }

            linkAsset.LaunchModalDialogOnElement(configObj, elemLink, true, !bInserting);

};

Telerik.Web.UI.Editor.CommandList["MOSSTemplateManager"] = function(commandName, editor, args)

{

            if (!RadE_HasRules)

            {

                        RTE2_InstantiateStaticSafeHtmlRules();

                        RadE_HasRules = true;

            }

            var params = editor._dialogParameters;

            var docEditor = editor.get_document();

            var configObj=new AssetPickerConfig("");

            configObj.ClientID=editor.get_id();

            configObj.DefaultAssetLocation="";

            configObj.CurrentWebBaseUrl=params["CurrentWebBaseUrl"];

            configObj.AllowExternalUrls=params["AllowExternalUrls"];

            var bInserting=false;

            var elemToReplace=null;

            var fragmentId=null;

            var elemViewToEdit=FormJSRTE_GetNearestContainingParentElementOfTypes(editor.get_contentWindow().frameElement.id, editor.getSelectedElement(), new Array("SPAN"));

            if ((elemViewToEdit !=null) && (elemViewToEdit.id==g_strRTE2ReusableFragmentCommonToken))

            {

                        fragmentId=elemViewToEdit.getAttribute("fragmentid");

            }

            var dialogInput=new Object();

            dialogInput.fragmentId=fragmentId;

            var callback=function(dialogOutput)

            {

                        if ((dialogOutput !=null) && (dialogOutput.fragmentView !=null))

                        {

                                    var selection=docEditor.selection;

                                    if (selection !=null)

                                    {

                                                if (selection.type=="Control")

                                                {

                                                            var controlRange=selection.createRange();

                                                            if (controlRange !=null)

                                                            {

                                                                        controlRange.execCommand("Delete");

                                                            }

                                                }

                                                if (selection.type !="Control")

                                                {

                                                            var textRange=selection.createRange();

                                                            if (textRange !=null)

                                                            {

                                                                        var safeHtmlDocument=RadE_CreateTemporaryDocument();

                                                                        safeHtmlDocument.body.innerHTML=dialogOutput.fragmentView;

                                                                        var elements=RTE2_GetAllElements(safeHtmlDocument);

                                                                        //setting these to hardcoded values since they are not passed in the params[] array yet.

                                                                        var instanceVariables = new Object();

                                                                        instanceVariables.EditorOpenFromWebPart = false;

                                                                        instanceVariables.DisableCustomStyles = false;

                                                                        RTE2_ApplyContentFilters(elements, instanceVariables);

                                                                        textRange.pasteHTML(dialogOutput.fragmentView);

                                                                        RTE2_AlterReusableFragmentHighlights(docEditor.body, "ms-reusableTextView");

                                                            }

                                                }

                                    }

                                    else

                                    {

                                                editor.pasteHtml(dialogOutput.fragmentView, commandName);

                                                RTE2_AlterReusableFragmentHighlights(docEditor.body, "ms-reusableTextView");

                                    }

                        }

            };

            var dialogUrl=params["CurrentWebBaseUrl"]+"/_layouts/ReusableTextPicker.aspx";

            commonShowModalDialog(dialogUrl, "dialogHeight:600px; dialogWidth:800px; center:yes; resizable:yes; scroll:no; status:no;", callback, dialogInput);

};

 

// support functions

function Telerk_MOSS_SetDirectionOfSelection(editor, strDirection)

{

            var rngSelection=editor.getSelection();

            var strTagNames;

            strTagNames="|H1|H2|H3|H4|H5|H6|P|PRE|TD|DIV|BLOCKQUOTE|DT|DD|TABLE|HR|IMG|BODY|TR|UL|OL|";

            if (rngSelection.getParentElement())

            {

                        var elemSelectionParent=rngSelection.getParentElement();

                        while ((elemSelectionParent !=null) && (strTagNames.indexOf("|"+elemSelectionParent.tagName+"|")==-1))

                        {

                                    elemSelectionParent=elemSelectionParent.parentNode;

                        }

                        if (elemSelectionParent)

                        {

                                    Telerik_MOSS_SetDirectionOnElement(elemSelectionParent, strDirection);

                        }

            }

}

 

function Telerik_MOSS_SetDirectionOnElement(element, strDirection)

{

            if ("ltr"==strDirection)

            {

                        element.dir="ltr";

                        element.align="left";

            }

            else if ("rtl"==strDirection)

            {

                        element.dir="rtl";

                        element.align="right";

            }

}

 

function RadE_CreateTemporaryDocument()

{

            // creating a temporary document for storing template content

            var iframe = document.createElement('iframe');

            document.body.appendChild(iframe);

            iframe.src = "javascript:'<html></html>'";

            iframe.frameBorder = '0';

            iframe.style.width = "0px";

            iframe.style.height = "0px";

            var doc = iframe.contentWindow.document;

            doc.open();

            doc.writeln('<head><style></style></head><body></body>');

            doc.close();

            if (!doc.body)

            {

                        var oBody = doc.createElement("body");

                        doc.appendChild(oBody);

            }

            if (doc.getElementsByTagName("head").length < 1)

            {

                        var oHead = doc.createElement("head");

                        oHead.style.visibility = "hidden";

                        doc.body.parentNode.insertBefore(oHead, doc.body);

            }

            return doc;

}

 

//this code belongs in form.js, however it is copied here as well since in some pages form.js is not loaded by default.

function FormJSRTE_GetNearestContainingParentElementOfTypes(strBaseElementID, elem, aTagNames)

{

            var aTagNames_length=aTagNames.length;

            if (elem==null) return null;

            for (var i=0; i<aTagNames_length; i++)

            {

                        if (elem.tagName==aTagNames[i])

                        {

                                    return elem;

                        }

            }

            var elemParent=elem.parentNode;

            while (elemParent !=null)

            {

                        if (elemParent.id==strBaseElementID)

                        {

                                    return null;

                        }

                        for (var i=0; i<aTagNames_length; i++)

                        {

                                    if (elemParent.tagName==aTagNames[i])

                                    {

                                                return elemParent;

                                    }

                        }

                        elemParent=elemParent.parentNode;

            }

            return null;

}

0
Stanimir
Telerik team
answered on 12 Oct 2009, 08:14 AM
Hello M V,

In order to fix this error you need to add a reference of a Script Manager to the current Master Page (default.master).

Please check the instructions in the following forum thread http://www.telerik.com/community/forums/sharepoint-2007/full-featured-editor/prerender-error-with-custom-list-form.aspx


Sincerely yours,
Stanimir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
M V
Top achievements
Rank 1
answered on 13 Oct 2009, 05:25 PM
Hi Stanimir,

We are not using the default.master page for these sites. We have a custom master page that we are using across other sites and this works across all the other sites where the RAD editor is used along with the custom list form. 

I can try the changes that you have suggested in the custom master page but curious enough the master page works fine in other sites with out the script manager option as well as with out the changes to the web.config? Sorry to keep the loop going.

Thanks
0
Stanimir
Telerik team
answered on 14 Oct 2009, 08:27 AM
Hi M V,

The reason for this error is that there is no ScriptManager loaded in the page. What you need to make sure is that you have s ScriptManger loaded before using the RadEditor.

Best wishes,
Stanimir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Sharepoint Integration
Asked by
M V
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
M V
Top achievements
Rank 1
Share this question
or