Copied to clipboard

Flag this post as spam?

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


  • DanielLeeUK 6 posts 26 karma points
    Jul 03, 2015 @ 08:31
    DanielLeeUK
    0

    Grid editor - rich text editor stripping hubspot form scripts

    Can anyone help with how best to solve this...

    We have the need to add hubspot forms onto out site, however when we add the script to the rich text editor umbraco strips the javascript out. When we add it to the includes section it adds it below the footer (and the correct form appears)

    My question is how do we include scripts within the body of the page without Umbraco stripping the code out. Is there a way to include using the includes function but target the script to display it in a certain position on the page?

    Many thanks

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 03, 2015 @ 08:42
    Dennis Aaen
    0

    Hi Daniel,

    What I normally do when I need to let the user add some JavaScript to page. I created a separate field, using the multiple textbox, the documentation can be found here

    https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors/Textbox-Multiple

    And when you pull out the data from the field you need to use the @Html.Raw function

    @{       
       if (CurrentPage.HasValue("introParagraph")){
           @Html.Raw(CurrentPage.introParagraph)
       }           
    }
    

    Hope this helps, and make sense.

    /Dennis

  • DanielLeeUK 6 posts 26 karma points
    Jul 03, 2015 @ 15:58
    DanielLeeUK
    0

    Hi Dennis,

    Thanks for the fast response.

    We don't have that functionality on our version i don't believe. We are using the Grid editor for reference.

    See the tool bar and rich text editor below.

    enter image description here

    enter image description here

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jul 03, 2015 @ 19:09
    Dennis Aaen
    0

    Hi Daniel,

    What I would do is to create a new tab or just put the new field under the an exstient tab, it could be e.g the options tab.

    I there I will add a new field, that use the data type called multiple textbox and give it a name and a alias. The alias could be e.g scripts.

    Then you will add this lines of code in your template where you want the code to appear it could be just before the body end tag.

    If you are unsure how to add new fields then try to see these free videos. http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/properties/ and http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/document-types/data-types/

    There are also many more videos that shows the basics working with Umbraco http://umbraco.tv/

    @{       
       if (CurrentPage.HasValue("scripts")){
           @Html.Raw(CurrentPage.scripts)
       }           
    }
    

    Hope this helps, and make sense.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft