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

Javascript within RadEditor is stripped

5 Answers 321 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 31 Jul 2007, 08:53 PM
I'm using RadEditor on a MOSS page with the following code:
<radE:RadHtmlField ID="PageContent" FieldName="PublishingPageContent" runat="server"/>
The control is used for the main content of a page, i.e. is not being used within a list.

When I enter javascript into the body of the editor, for example <a href="#" onclick="alert('hello');">hello</a>, the javascript code is stripped out.

I have seen recommendations to enable various properties within the config file, but it's not clear how to specify a config file when the RadHtmlField method is used.

Can you explain how to keep javascript from being removed?

5 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 01 Aug 2007, 07:47 AM
Hello J,

In the new version of RadEditor for MOSS standard edition which will appear in a couple of days, it will be possible to insert Javascripts in certain scenarios, however some additional properties must be set :

RadEditor in WebPart:
Set (add if not present) the AllowScripts property to true in ConfigFile.xml

RadEditor in WCM:
Set (add if not present) the AllowScripts and AllowSpecialTags properties to true in ConfigFile.xml

SharePoint forms scenario (Lists, Wikis, Blogs, etc.)
You cannot use Javascript in RadEditor in such scenario. There RadEditor does not have control over the presentation view which means that we cannot control the output when it is not in edit mode.



The configuration file for RadEditor differs depending on which editor you want to setup.

Web Part and WCM scenario
You need to modify the ConfigFile.xml which is located in the following folder:
/Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/4.3.0.0__1f131a624888eeed/RadControls/Editor/

SharePoint forms scenario (Lists, Wikis, Blogs, etc.)
You need to modify the ListConfigFile.xml located in the same folder

As for your second question, you can set the ConfigFile and ToolsFile properties of the RadEditor for MOSS in the WCM field by using the SharePoint Designer. To do so:

  1. Open SharePoint Designer and navigate to the desired page
  2. Open the page and choose Edit Page Layout
  3. Click in the radE:RadHtmlField control so the TagProperties pane is updated with the control
  4. Set the desired properties



All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
J
Top achievements
Rank 1
answered on 29 Aug 2007, 01:53 PM
Georgi,
   I have installed the new version of the MOSS control. I set AllowScripts to true in the configfile.xml and I set the AllowSpecialTags tag to true on my RadHtmlField in SharePoint Designer. (AllowSpecialTags does not appear to be a valid value in configfile.xml.)

But it still seems to strip out Javascript.

J
0
J
Top achievements
Rank 1
answered on 29 Aug 2007, 02:40 PM
Georgi,
   Never mind, I see that my question has been answered in this thread:

http://www.telerik.com/community/forums/thread/b311D-heckm.aspx

The solution described there (using script tags) worked for me.

Thanks,

J
0
Per Hoyer Stensnaes
Top achievements
Rank 1
answered on 04 Sep 2009, 09:18 AM
"Set (add if not present) the AllowScripts and AllowSpecialTags properties to true in ConfigFile.xml"
AllowSpecialTags is not permittet in the configfile.xml - you should set that directly in the radE:RichHtmlField tag in the layoutpage - BUT it dosnt prevent the onclick, onmouseover etc from beeing stripped.
as well there are A LOT of styling props that will be stripped fx.:
<table style="background-image:url('/images/myPic.jpg');" will be stripped.
...
0
Stanimir
Telerik team
answered on 07 Sep 2009, 08:57 AM
Hi Per,

If you are using the latest version of RadEditor for MOSS, which is 5.5.1, in WCM scenario you need to set both AllowScripts and AllowSpecialTags properties to true in the current page using SharePoint Designer.
For example:
<telerik:RadHtmlField id="Content" AllowScripts="true" AllowSpecialTags="true" FieldName="PublishingPageContent"  runat="server"/> 

Regarding this issue "BUT it dosnt prevent the onclick, onmouseover etc from beeing stripped.", this seems to be yet another problem, caused by the MOSS content filter. When you submit the page, MOSS will validate it and automatically make changes if the content is not valid. You can verify this by trying to enter the same content with the original SharePoint rich text editor. We have not been able to find a workaround for this behavior yet.

Greetings,
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
WebParts for SharePoint
Asked by
J
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
J
Top achievements
Rank 1
Per Hoyer Stensnaes
Top achievements
Rank 1
Stanimir
Telerik team
Share this question
or