Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am using a macro to embed a hubspot form code into a parameter that is a textarea called embed.
The macro itself just renders the embed code in the parameter like so:
The output of this is literally printing the html markup that I put into the macro parameter.
If I output just the parameter without Html.Raw then I get the decoded markup printed out. ( & instead of "&")
I've done this in previous versions of Umbraco just fine but it seems that I can no longer do this in v8. Am I missing something? Is there a way to solve this? For now I am just going to put the direct code I need into the macro but I lose the flexibility of letting editors add their own various hubspot forms on other pages. Any ideas how I could output the code from the parameter as actual HTML markup? Thank you!
This works on RTE but when we actually render it on the template then I can replicate your issue on v8.1.3
So, it's a bug that needs to be reported to HQ.
Oh, thank you. I didn't realize it was a bug. I was using the macro in the grid editor to insert the macro. I didn't try this macro directly in the RTE though.
Are you saying you were able to see the issue when you were inserting the macro in the RTE?
I just want to make sure I understand what you tried before submitting a bug to explain it. Thank you for checking it out!
All the macro parameter values are stored HTML-encoded, since they may be inside the HTML content of the RTE. Version 8 is missing a HTML decoding step, so the values you get from Model.MacroParameters are still encoded.
I think it's just been missed when the macro rendering code was rewritten - in version 7 the decoding step was pretty well hidden in old code.
It worked fine when i viewed in the RTE in back-office.
But when we rendered on the template (as below) then it was literally printing the html markup.
I submitted a bug on github for this.
I tested trying to render the macro through the RTE and the macro actually disappears after I save the page (it is marked as use in RTE but not render in RTE - I don't need to see the code rendered in the backoffice).
Also, thank you both for responding and checking this out!
Updating the workaround here in case others are looking for similar issue.
The macro parameter value is stored encoded and hence when you use the @Html.Raw(..) it renders the html mark up. As a workaround i tried performing a decode before passing it onto the Raw function and i was able to render the HTML form. Below is the code i used.
PS:This is a workaround until the issue is fixed by HQ.
I couldn't manage to get the backoffice showing the form render but the webpage shows it right.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted