+1-888-365-2779
Try Now
More in this section

Forums / Deployment / inline javascript

inline javascript

28 posts, 0 answered
  1. mark
    mark avatar
    22 posts
    Registered:
    05 Sep 2008
    10 Nov 2008
    Link to this post
    when entering inline javascript (both src= and open script) the script is removed when you go back to a page to re-edit
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Nov 2008
    Link to this post
    Hello mark,

    We kindly ask you to be a bit more specific when describing A problem - is this happens in some page control? Is it happening in the Modules section, or you use the Generic Content control?
    I suspect that you use the Generic Content Control, or Generic Content module - this is a known issue for version 3.5 and is fixed in 3.5SP1. If this is the case, we suggest you upgrading to SP1.

    On a side note, we have checked your account - you have about 15 threads started but no downloads of any Sitefinity product. Could you elaborate where did you get your Sitefinity copy from? We would look forward for your response.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. mark
    mark avatar
    22 posts
    Registered:
    05 Sep 2008
    11 Nov 2008
    Link to this post
    its in general content.

    im using a personal email account in case of spam the sitefinity product is being developed for xrio.com and will be purchased (if it hasnt been already) once the site is ready to go live
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    12 Nov 2008
    Link to this post
    Hello mark,

    Thank you for getting back to us. We will have to relate this account to Xrio license then. This will really help us to track your issues and provide you with a better service in future.

    The case you described is indeed the one I was talking about. Upgrading to 3.5SP1 will fix it.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Matt
    Matt avatar
    22 posts
    Registered:
    25 Jan 2008
    14 Nov 2008
    Link to this post
    Hi Georgi-

    We're on 3.5.1747 and having the same problem. JavaScript blocks are being stripped out from the Generic Content control (either on a page or via Modules) when switching out of source view and back to WYSIWYG.
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    17 Nov 2008
    Link to this post
    Hello Matt,

    Have you enabled scripts in the editor?
    There is AllowScripts which you can set to True for every RadEditor instance. Just open your control templates, find the <RadEditor> instance define AllowScripts="True".

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Chris
    Chris avatar
    8 posts
    Registered:
    07 Oct 2008
    10 Dec 2008
    Link to this post
    This does not work in 3.5 SP1.
    Even with AllowScripts set to true:
    When you enter a script block into a generic content control it is saved and is shown on the page. But when you go back to edit it is removed from the RadEditor and you lose it.
    Also, if you enter the script block in HTML view then switch to design view, the script block is removed.
    I have been unable to find decent documentation on using ContentFilters, is this potentially a workaround? And is there documentation on how to implement them to remove the content filtering that removes script blocks?
    Thanks,
    Chris.
  8. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    10 Dec 2008
    Link to this post
    Hello Chris,

    Please leave the AllowScript="true" and add ContentFilters="None", this should enable the scripts in the RadEditor. In the future versions the AllowScript Property will be obsolete.

    All the best,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  9. Elizabeth
    Elizabeth avatar
    83 posts
    Registered:
    23 Mar 2005
    05 Jan 2009
    Link to this post
    You said:;

    There is AllowScripts which you can set to True for every RadEditor instance. Just open your control templates, find the <RadEditor> instance define AllowScripts="True".

    Where do I do this? Is this through the admin section using the web browser or is there a file (or files) that I need to edit via visual studio?
  10. Chris
    Chris avatar
    8 posts
    Registered:
    07 Oct 2008
    06 Jan 2009
    Link to this post
    You need to edit files in visual studio.

    They will be under the ControlTemplates directory (or directories).

    You probably will want to make the change for any telerik:RadEditor control you find.

    I found that I wanted AllowScripts="true" and ContentFilters="ConvertToXhtml" by default, and for the moment I have only made the change for RadEditor controls for generic content.

    Chris.
  11. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    06 Jan 2009
    Link to this post
    Hi Chris,

    The files you need to edit for Generic Content module are "ControlPanelEdit.ascx" and "ControlPanelInsert,ascx" located in ~\Sitefinity\Admin\ControlTemplates\Generic_Content folder. Insert AllowScripts="true" and ContentFilters="None" in the RadEditor tag:

    <telerik:RadEditor 

    Regards,
    Nikolay
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  12. Kristian
    Kristian avatar
    5 posts
    Registered:
    10 Oct 2005
    04 Mar 2009
    Link to this post
    I'm in version 3.6 (upgraded from 3.5) and have made the modifications as described. I am still seeing any javascript inserted removed.  Specifically, it is taking <script...    to ..../script> out.

    Here is the section from my rad editor instance:
    <telerik:RadEditor runat="server" ID="RadEditor1"
      ContentAreaCssFile="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorContentArea.css"
      ToolsFile="~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml"    
      Skin="WebBlue"    
      NewLineBr="False"
      AllowScripts="True"
      ContentFilters="None"
      Height="360px"
      Width="98%">
      <ImageManager ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images" />
      <MediaManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
      <FlashManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
      <DocumentManager ViewPaths="~/Files" UploadPaths="~/Files" DeletePaths="~/Files" />
      <CssFiles>
            <telerik:EditorCssFile Value="~/Sitefinity/Admin/Themes/Default/AjaxControlsSkins/Sitefinity/EditorCssFile.css" />
      </CssFiles>
    </telerik:RadEditor>

    I haven't touched anything else in it.

    Am I missing something?

    Thanks!

    Kristian
  13. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    05 Mar 2009
    Link to this post
    Hello Kristian Reich,

    By default version 3.6 uses its embedded templates, and in these templates scripts are forbidden by default. So, are you sure you have mapped the templates you are using correctly and that you are indeed using your external templates?

    Regards,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  14. Kristian
    Kristian avatar
    5 posts
    Registered:
    10 Oct 2005
    05 Mar 2009
    Link to this post
    I was not.

    We are on version 3.6.1861 and the control templates reference 3.6.1870 version.  Having just gone from 3.5 and having to re-implement customizations we need to actually launch our system not upgrade and go through that process of having to re-customize again. 

    I am in the process of seeing if the templates and customizations files will work, but they all seem to lack a reference to the controlpaneledit/insert and the editortemplate files in generic content.

    I did find:
        <!--Provides user interface for previewing a content item in the Generic Content module.-->
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemPreview`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentPreview.ascx" />
        <!--Provides user interface for editing a content item in the Generic Content module.-->
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentEditView.ascx" />
        <!--Provides user interface for adding a new content item in the Generic Content module.-->
        <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.ContentItemNew`1[[Telerik.Cms.Engine.WebControls.Admin.ContentItemsView, Telerik.Cms.Engine]]" layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/ContentNewView.ascx" />

    but these do not exist in my version.  I do have the files referenced here in this thread though - controlpaneledit, etc...

    Am I going to have to upgrade to the hotfix and go through the finding all my customizations again or can I get it running?  Not having inline javascript is not an option as we do flash work here that requires some custom client side script per item.

    Thanks!

    Kristian




  15. Nikolai
    Nikolai avatar
    216 posts
    Registered:
    21 Nov 2016
    06 Mar 2009
    Link to this post
    Hello Kristian,

    There are errors with the template mappings for version 3.6 (1861) so you should upgrade to 3.6 Hotfix (1870).

    All the best,
    Nikolai
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  16. Kristian
    Kristian avatar
    5 posts
    Registered:
    10 Oct 2005
    06 Mar 2009
    Link to this post
    What is entailed in the hotfix?  Is it going to overwrite templates again?  My guess would be that it not only will overwrite them but also do some renaming, so I'll end up re-applying customizations, correct?  But, after this, I shouldn't have to worry again?
  17. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    07 Mar 2009
    Link to this post
    Hi Kristian,

    We will not override any customizations and templates this time. You should only change the bin directory and see if there are differences in the web.config file.

    All the best,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  18. Kelly Ward
    Kelly Ward avatar
    7 posts
    Registered:
    04 Dec 2009
    23 Dec 2009
    Link to this post
    Hi Nikolay,

    We are using 3.7.2, and it's keeping the javascript code in there (in the generic content block), it's not removing it when going back from design to html mode, and viewing the source on the front end page does show the javascript, it's just not executing it.  I saw some threads about files to edit to allow the script, my question is are those the same file names for the version we are using, just not sure if something has changed in this version and wanted to check before I send my developer into the code.

    Thanks,
    Kelly
  19. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Dec 2009
    Link to this post
    Hello Kelly Ward,

    If you are using Sitefinity 3.7 version you have to map the external template for the desired view or control and add RemoveScripts filter. For instance if you want to modify the RadEditor's properties in GenericContent control you have to map GenericContentDesigner template as shown below

    <viewSettings hostType="Telerik.Cms.Engine.WebControls.Design.GenericContentDesigner"
                      layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Generic_Content/GenericContentDesigner.ascx" />

    Then you can set ContentFilters property of the RadEditor control as described above. More information about the mapping at How to map an external template

    Sincerely yours,
    Ivan Dimitrov
    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.
  20. Kelly Ward
    Kelly Ward avatar
    7 posts
    Registered:
    04 Dec 2009
    24 Dec 2009
    Link to this post
    Hi,

    We tried making these changes and the scripts still aren't getting executed on the page.  We have also added to a page a form which also isn't appearing either.  I am assuming both are related.    Let me know what you think.

    Kelly
  21. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    24 Dec 2009
    Link to this post
    Hi Kelly Ward,

    Once the filter is added the script tags are stripped when you save the control or when you switch the Edit modes. Please take a look at the attached video.

    Kind regards,
    Ivan Dimitrov
    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.
  22. Kelly Ward
    Kelly Ward avatar
    7 posts
    Registered:
    04 Dec 2009
    24 Dec 2009
    Link to this post
    Hi,

    The scripts aren't stripped.  When you view the source of the published page the scripts and form code is there it just doesn't appear on the page.  See this page as an example http://convertertechnology.redleafdevelopment.com/support/downloads.aspx We have added a simple script just above the bulleted list to create an email link that will populate the email with the subject and body.

    thanks,
    Kelly
  23. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    25 Dec 2009
    Link to this post
    Hi Kelly Ward,

    As far as I see this is a working link which just creates MailTo link.

    We are using 3.7.2, and it's keeping the javascript code in there (in the generic content block), it's not removing it when going back from design to html mode,

    If the RemoveScripts is not added to the RadEditor declaration the script will not be removed from the html. The video I sent you clearly shows this.

    and viewing the source on the front end page does show the javascript, it's just not executing it.


    The js is on your page and it is executed. When you click on the link your mail client - say Outlook will open a new email to . However the js on your website is not executed because you have missed one single quote in the last line, which actually throws the js error.

    The code below should work correctly and the script will be executed - it will show the "email us" link.

    <script type="text/javascript" language="Javascript">
     
    <!-- // hide from old browsers
     //variables
     var user = "jmarshall"; //for example - "joe_bloggs"
     var domain = "convertertechnology.com"; //for example - "hotmail.com"
     var subject = "Login Request"; //for example = "website feedback"
     var bodytext = "Please contact me regarding login credentials for software downloads"; //for example - "dear Joe, here are my comments"
     document.write('<a href=\"mailto:' + user + '@' + domain + '?subject=' + subject + '&body=' + bodytext + '\">');
    document.write('email us</a>');
     
    // -->
    </script>

     
    Greetings,
    Ivan Dimitrov
    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.
  24. Kelly Ward
    Kelly Ward avatar
    7 posts
    Registered:
    04 Dec 2009
    28 Dec 2009
    Link to this post
    Hi,

    I added that single quote and it still doesn't show.  Another example is this page http://convertertechnology.redleafdevelopment.com/support/chat.aspx.  It is just a single javascript call to bring in a file and that doesn't work either.  Then there is this page http://convertertechnology.redleafdevelopment.com/contact/contact_form/RequestODRAform.aspx which has a form in it that also doesn't display.  I am guessing all three pages are not working for the same reason.

    thanks,
    Kelly
  25. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Dec 2009
    Link to this post
    Hello Kelly Ward,

    This problem does not seem to be related to Sitefinity. It is related to your js code. I checked the js  code at http://convertertechnology.redleafdevelopment.com/support/downloads.aspx using GenericContent and the text was correctly displayed. Can you add the code from my previous reply to GenericContent control from our demo website and try to reproduce this issue - http://demo.sitefinity.com/. In ASP.NET you can only have one form element which is generally added to your master page.

    Kind regards,
    Ivan Dimitrov
    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.
  26. Kelly Ward
    Kelly Ward avatar
    7 posts
    Registered:
    04 Dec 2009
    28 Dec 2009
    Link to this post

    Hi Ivan,

    I have added that same javascript to this page on your demo site in the top of the page http://demo.sitefinity.com/AboutUs/Housing.aspx and it doesn't show up for me there either.  Regarding your other comment about the .Net pages only being able have one form tag.  How do you suggest that the client be able to add forms to the site if that is the case?

     

    thank you for all your help,

    Kelly

  27. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Dec 2009
    Link to this post
    Hi Kelly Ward,

    The code that was posted in the GenericContent was not the same as I posted above. Could you check the page again http://demo.sitefinity.com/AboutUs/Housing.aspx. In your code the following attributes were appended - originalAttribute="href" originalPath="mailto:""
    As for the second question - possible solution is using Iframe

    All the best,
    Ivan Dimitrov
    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.
  28. Kelly Ward
    Kelly Ward avatar
    7 posts
    Registered:
    04 Dec 2009
    28 Dec 2009
    Link to this post
    Hi Ivan,

    I will talk to my developer about creating an iFrame for the forms, thank you.

    regarding the javascript link, it looks like what you gave me was a way to do it without using the javascript? <a href="mailto:jmarshall@convertertechnology.com?subject=Login Request&amp;body=Please contact me regarding login credentials for software downloads">email us</a> which I am fine with using. 

    But we have tried to include the following jscript on to the chat page referenced above and that code is not working either <!-- BEGIN LIVECHAT track tag. See also www.livechatinc.com --> <script src="http://chat.livechatinc.net/licence/1025997/script.cgi?lang=en&amp;groups=0" type="text/javascript"></script> <!-- END LIVECHAT track tag. See also www.livechatinc.com -->

    thanks,
    Kelly
Register for webinar
28 posts, 0 answered