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

Javascript OnLoad Format Stripper Not Supported

3 Answers 68 Views
Editor
This is a migrated thread and some comments may be shown as answers.
pcomtois
Top achievements
Rank 1
pcomtois asked on 12 Oct 2010, 09:01 PM
Hi I am using version 7.1.1.0 of the Ajax RadEditor and cannot upgrade. I need to strip out all Word tags and HTML with the exception of bold, italic, underline and some special characters like trademark, and copywright.

I added the following javascript from the documentation so I can strip the tags on the sumbit :

<script type='text/javascript'>

function OnClientLoad(editor, args)

{

editor.add_submit(function ()

{

editor.fire('SelectAll');

editor.fire('FormatStripper', {value : 'WORD'});

alert(editor.get_html());

});

}

</script>



when the page loads I receive the following javascript alert: 
"Exception while exeduting client event OnClientLoad Error:Object doesn't support this property or method"

Again all I need to do is remove all word tags, script, span, and div tags.

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Oct 2010, 09:57 AM
Hi,

Version 7.1.1 is the classic editor, but not the new RadEditor for ASP.NET AJAX. The problem that you experience is due to that the code applies to the new editor. Here is the code for RadEditor Classic:

<script type="text/javascript">
function OnClientSubmit(editor)
{
    var oTool = new Object();
    oTool.GetSelectedValue = function ()
    {
       return "WORD"; // the other possible options are ALL, CSS, WORD_ALL
    };     
    editor.Fire("FormatStripper", oTool);     
}
</script>
<radE:RadEditor id="RadEditor1" Runat="server"  OnClientSubmit="OnClientSubmit"></radE:RadEditor>


Kind regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
pcomtois
Top achievements
Rank 1
answered on 13 Oct 2010, 07:17 PM
Thanks for your help but I thought this would be called on the submit of the form and it did not. I realized it was called on the submit of the control which I am not submitting. I added javascript to call a similar method on the submit of my form included below and it seems to work because when I add head tags it removes them. However it is not remove any meta, link, font,div,span, or other HTML tags. The only tags I want are basic strong, b, and Italic. I am not a javascript wiz so any help would be great. I thought the "All" of the format stripper would remove all HTML including  font,div,span.

 

 

<script type='text/javascript'>

 

function getEditor() {

    return RadEditorGlobalArray[0];

}

function OnClientLoad(editor){

editor.AttachEventHandler ('onmouseout', function (e)

{

var oTool = new Object();

oTool.GetSelectedValue = function ()

{

return 'All'; // the other possible options are All, CSS, WORD_ALL

};

editor.Fire('FormatStripper', oTool);  

 

}

);

}

</script>

function filterAbstractContent()

var editor = getEditor();   //method above

 

var oTool = new Object();

oTool.GetSelectedValue = function ()

{

return 'All'; // the other possible options are All, CSS, WORD_ALL

};

editor.Fire('FormatStripper', oTool);

var content = editor.GetHtml(true);

alert(content)

}


Thanks,
Paul.
 

0
Rumen
Telerik team
answered on 18 Oct 2010, 08:34 AM
Hi,

The correct argument for the FormatStripper is ALL (not All). Please update the value and the stripper will work as expected. For your convenience I have attached my test page.

All the best,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
pcomtois
Top achievements
Rank 1
Answers by
Rumen
Telerik team
pcomtois
Top achievements
Rank 1
Share this question
or