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

Adding Script Tags within Rad Control Editor

3 Answers 160 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 05 Feb 2009, 10:19 PM
I have tried serveral times throughout the day to insert <script> tags to the editor via another javascdript function that I run.  This happens when I try to insert the following code in the editor.pasteHTML() function:

 

<script type="text/javascript">

AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','1234','height','1234','title','menu','src','assets/4/mutliple_fileupload','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','allowscriptaccess','always','movie','assets/4/mutliple_fileupload' ); //end AC code

</script>

<noscript>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="200" height="200" title="menu">

<param name="movie" value="assets/4/mutliple_fileupload">

<param name="quality" value="high">

<param name="allowScriptAccess" value="always" />

<embed src="assets/4/mutliple_fileupload" type="application/x-shockwave-flash" width="1234" height="1234" allowscriptaccess="always"></embed>

</object>

</noscript>

When I removed the <script> tags in the text above it added the flash fine to the editor.  I have tried serveral properties, AllowScripts=True, radControl.DisableFilter(EditorFilters.RemoveScripts).  Any ideas?

Thanks,
PM

 

 

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 09 Feb 2009, 07:01 AM
Hello Paul,

To insert the script tag via the pasteHtml method you should put some content before the script tag in other case the script tag will be stripped by the browser. For example put a simple &nbsp; entity before the script tag, e.g.

<script type="text/javascript">  
function SetContent()  
{  
    var script = '&nbsp;<script type="text/javascript">'
    script += "AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','1234','height','1234','title','menu','src','assets/4/mutliple_fileupload','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','allowscriptaccess','always','movie','assets/4/mutliple_fileupload' ); //end AC code"
    script += "<\/script>;"
    script += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='200' height='200' title='menu'>" 
    script += "<param name='movie' value='assets/4/mutliple_fileupload'>"
    script += "<param name='quality' value='high'>"
    script += "<param name='allowScriptAccess' value='always' />"
    script += "<embed src='assets/4/mutliple_fileupload' type='application/x-shockwave-flash' width='1234' height='1234' allowscriptaccess='always'></embed>"
    script += "</object>"
    script += "}"
  
    var editor = $find("<%=RadEditor1.ClientID %>"); 
    editor.pasteHtml(script); 
       
</script> 


You should also disable the  radControl.DisableFilter(EditorFilters.RemoveScripts) filter.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kevin Warnke
Top achievements
Rank 1
answered on 06 Apr 2009, 07:20 PM
I'm at a loss.

I added radControl.DisableFilter(EditorFilters.RemoveScripts) and set validateRequest=false in the ASPX page.

When I manually type a <script> block into the HTML editor and Save the <script> is still being removed.  The Content property on the radControl doesn't have the <script> in it so I'm not sure when it's being removed.

Any ideas what else I need to do in order to get this to work?

Thanks,
Kevin
0
Rumen
Telerik team
answered on 09 Apr 2009, 12:48 PM
Hi Kevin,

Could you please test the following live example and see whether you are able to reproduce the problem after unchecking the RemoveScripts checkbox and hitting the Set Built-in Filters button? If you are able to reproduce the problem, send us sample js content and steps to reproduce.

If you experience this problem only in your project, please open a support ticket and send a sample fully working project that demonstrates the problem. I will examine your code and provide a solution after reproducing the issue on my end.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Paul
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Kevin Warnke
Top achievements
Rank 1
Share this question
or