<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
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:
- Open SharePoint Designer and navigate to the desired page
- Open the page and choose Edit Page Layout
- Click in the radE:RadHtmlField control so the TagProperties pane is updated with the control
- Set the desired properties
All the best,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
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
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
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.
...
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.