Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carlos 338 posts 472 karma points
    Apr 05, 2011 @ 21:56
    Carlos
    0

    Javascript in RTE

    I am trying to write javascript in the RTE.  I changed the TinyMCE config to accept "script[language|src|type]" in the validElements. This works only if you don't save it. After you save the JS in the RTE I get a "[tidy error]" output in the RTE and in the HTML.

    I see it puts the CDATA inside the script tags in the RTE if you try to let the RTE accept the script[language|src|type] but I am having a feeling that the CDATA stuff is causing the [tidy error] output.

    Any suggestions? I tried making an XSLT file so I can use the Macro in my custom property, BUT I am having an issue with my custom property using the RTE to render the Macro in the HTML.  I have posted my other dilemma here.  

    If anyone has suggestions please let me know.

     

    Thanks.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 05, 2011 @ 22:06
    Jan Skovgaard
    0

    Hi Carlos

    You could disable tidy in umbracoSettings.config I suppose but I really don't recommend that. JavaScript in the rich text editor should be avoided.

    Why do you need to insert it into the RTE?

    I think I have also made an answer to the reffered post if my mind is not playing tricks on me :-)

    /Jan

  • Carlos 338 posts 472 karma points
    Apr 05, 2011 @ 22:15
    Carlos
    0

    Jan, yes that other post is what I am trying to do. I am trying to make an Macro spit out the Javascript. I was thinking I could get around it by placing the Javascript directly inside of the RTE.  I am trying to put a Twitter script inside the editor area. We have other pages using the same template, so I only want the script to show up in one part of the site and not all the other pages that use the same template.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 05, 2011 @ 22:20
    Kim Andersen
    0

    Hi Carlos

    Just a small note. Whenever I need to put a piece of javascript on one of my sites, I tend to use the textbox multiple instead of a RTE (unless I'm having the script inside one of my macros of course :) ). The textbox multiple will not strip any of the script that you inserted into it. So this could maybe be the solution for you too.

    /Kim A

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 05, 2011 @ 22:20
    Jan Skovgaard
    0

    Hi Carlos

    I can understand that.

    But is it not possible to create another macro for this, that you can place in the RTE? Or am I missing it totally?

    Otherwise...have you considered creating another template for the node in question? On the document type you can then select the template to be allowed to be used on this document type.

    On the node you can use this specific template for this site only and then you can create the twitter feed in there and then it will only be shown in that specific page.

    /Jan

  • Carlos 338 posts 472 karma points
    Apr 05, 2011 @ 22:25
    Carlos
    0

    Jan, Kim figured it out on the last post about the other issue I was having. 

    It is hard to explain through a forum and text unless I were to try to show this issue real time.  I guess using the multiple text box could be an solution too. Although my content authors are not that HTML savvy. Oh well.

    Thanks for the help. I really enjoy the help on these forums.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 05, 2011 @ 22:27
    Jan Skovgaard
    0

    Hi Carlos

    Yes, it was good to see.

    But otherwise consider using an alternate template if it's possible. What you're doing sounds to be a bit complex and easy to cause confusion (I know that I tend to spend some time to "get" old code written a couple of month ago - So the simpler the better, right? :))

    But it's great that you have got your issue solved and is able to move on to the next task :-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft