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

Problem saving javascript

5 Answers 78 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vitali
Top achievements
Rank 1
Vitali asked on 12 Feb 2008, 11:28 PM
Hi,
when I save the javascript in the RadEditor, it changes it from

<script type="text/javascript">
document.write('<script src="aa.js" type="text/javascript"></script>');
</script>

to

<script type="text/javascript">
document.write('
<script src="aa.js" type="text/javascript"></script>
');

It brakes my page. How I can disable ANY format changes in the RadEditor.

Thank you

5 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 14 Feb 2008, 03:31 PM
Hi Vitali,

Please, use the following syntax to set the script tag:

<script type="text/javascript">
document.write('<' + 'script src="aa.js" type="text/javascript"></' + 'script>');
</script>

Note how the '</s'+'cript>'); strings are concatenated.


Best wishes,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Tammie
Top achievements
Rank 1
answered on 14 Feb 2008, 07:22 PM
Hi there,

This isn't an acceptable workaround for us. This assumes that the users of the editor are all developers... if we are all developers then there really isn't a point to having an editor like this. The marketing folks will generate add code and then copy their ad code into the editor and save it. We need a way for the code to be preserved as it is copied when it is loaded back into the editor. Is there anyway to do this? This seems like a bug to me and the workaround forces us to write code in a way that doesn't make sense.

Thanks,
Tammie
0
Rumen
Telerik team
answered on 15 Feb 2008, 03:55 PM
Hi Tammie,

The problem is due to the HTML indentation filter of the editor. We will provide the ability to disable this filter in the upcoming SP release of RadControls. This will help you to fix the problem on your side.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shane
Top achievements
Rank 1
answered on 26 Jul 2008, 11:03 AM
Hi Rumen,

Is this issue fixed? How can we achieve this without disabling the filter?

I don't want to loose the indentation, at the same time I want my JavaScript to work properly.

Thanks in advance!

Regards,
Shane

0
Rumen
Telerik team
answered on 28 Jul 2008, 01:46 PM
Hi Shane,

When the browser sees a closing </script> tag it automatically closes the opening tag. The reason for the problem is this browser behavior independently on that the </script> tag is part of the document write string. That is why to workaround the problem you need to change the script string to '</s'+'cript>', e.g.

<script type="text/javascript">
document.write('<' + 'script src="aa.js" type="text/javascript"></' + 'script>');
</script>

Best regards,
Rumen
the Telerik team

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