Is there a way in Umbraco 7 to save script-elements with CDATA in the umbraco.xml?
When trying to publish a textbox multiple with CDATA I get the error "Cannot have ']]>' inside an XML CDATA block.".
Umbraco 6 had the old datatype textbox multiple that allowed to save CDATA tags by replacing: _data.Value = this.Text.Replace("<![CDATA[", "<!--CDATAOPENTAG-->").Replace("]]>", "<!--CDATACLOSETAG-->");
Is there any specific reason that you need to save your content as CDATA?
Not sure if it should/would work in Umbraco 7 since the umbraco.config xml schema has changed since v6 though. But perhaps there is another way around it.
Yeah, I had a suspicion about that - You should be able to save scripts etc. without it being wrapped in CDATA - it's only necessary to wrap your scripts like that if you're using XHTML - But since most XHTML based sites are not served with the proper mime-type anyway I don't think it matters...and if you're just using a html doctype then you can leave it out.
But perhaps it's a good idea to file a bug report about this on the issue tracker anyway if you would like? http://issues.umbraco.org/issues
I also have the requirement to let the customer enter a Google-script and got a similar problem with CDATA in textbox multiple.
In Umbraco v7.2.8 I can save a script with a CDATA comment in textbox multiple without an error message. But when I include this property in the template like this
I am trying to publish a google conversion tracking code in an Umbraco simple editor field and it keeps giving an error message of "Cannot have ']]>' inside an XML CDATA block.".
I have run into this as well. The issue is exactly as described above, I was using the textbox multiple to allow content editora to add tracking code to a page. Many of these tracking code snippets can contain CDATA wrappers in them. It is hard to explain to non-technical content editor how to remove the CDATA wrappers and not mess the tracking code up.
I am hoping that the issue goes away with "Cache Nouveau" in version 8 but in the mean time I just created my own textbox multiple for scripts that scrubs the CDATA out.
Saving CDATA in Umbraco 7
Is there a way in Umbraco 7 to save script-elements with CDATA in the umbraco.xml?
When trying to publish a textbox multiple with CDATA I get the error "Cannot have ']]>' inside an XML CDATA block.".
Umbraco 6 had the old datatype textbox multiple that allowed to save CDATA tags by replacing:
_data.Value = this.Text.Replace("<![CDATA[", "<!--CDATAOPENTAG-->").Replace("]]>", "<!--CDATACLOSETAG-->");
Hi kammalanda
Is there any specific reason that you need to save your content as CDATA?
Not sure if it should/would work in Umbraco 7 since the umbraco.config xml schema has changed since v6 though. But perhaps there is another way around it.
/Jan
Hi Jan!
A customer should be able to put Google Conversion Code on different pages.
Hi kammalanda
Yeah, I had a suspicion about that - You should be able to save scripts etc. without it being wrapped in CDATA - it's only necessary to wrap your scripts like that if you're using XHTML - But since most XHTML based sites are not served with the proper mime-type anyway I don't think it matters...and if you're just using a html doctype then you can leave it out.
But perhaps it's a good idea to file a bug report about this on the issue tracker anyway if you would like? http://issues.umbraco.org/issues
Hope this helps.
/Jan
I know that, but I do not want the customer (or web marketer) to modify the code snippets. I will report an issue on issues.umbraco.org, thanks Jan!
This is definitively a bummer - was much easier in v6
http://issues.umbraco.org/issue/U4-6091
Hi everyone,
I also have the requirement to let the customer enter a Google-script and got a similar problem with CDATA in textbox multiple.
In Umbraco v7.2.8 I can save a script with a CDATA comment in textbox multiple without an error message. But when I include this property in the template like this
the rendered script-tag is corrupted:
The error appears in this line, where the closing bracket and closing comment is missing:
Should be:
The result is, that the following html is not rendered, because for the browser it's part of the script:
I cannot find any response from the Umbraco team. Is there any progress at the reported bug?
Best regards,
Ben
Is there a solution to this issue yet?
I am trying to publish a google conversion tracking code in an Umbraco simple editor field and it keeps giving an error message of "Cannot have ']]>' inside an XML CDATA block.".
Interestingly, there was a very old issue for this that was commented as "assumed fixed": http://issues.umbraco.org/issue/U4-566
Sorry to revive this, but I'm having this issue as well for exactly the same reason in 7.3.1.
Should we just open an issue for this, or will an upgrade take care of it?
I have run into this as well. The issue is exactly as described above, I was using the textbox multiple to allow content editora to add tracking code to a page. Many of these tracking code snippets can contain CDATA wrappers in them. It is hard to explain to non-technical content editor how to remove the CDATA wrappers and not mess the tracking code up.
I am hoping that the issue goes away with "Cache Nouveau" in version 8 but in the mean time I just created my own textbox multiple for scripts that scrubs the CDATA out.
OK, this is how we solved it for now - using content accesses the DB directly where there is no problem with the data, but it bypasses the cache:
A bit late, but I ran into this problem (which, sadly, is still present, at least in 7.5).
Wouldn't it be better to use ContentService and IContent for this? Like:
(not using Model.Id explicitly since the above was originally in a ModelsBuilder generated class expansion where I naturally used this.Id)
Thanks, this worked. Will have to deal with the extra database hit.
Still an issue on 7.5.11
This bug still exists in 7.15.3, so I re-reported it.
https://github.com/umbraco/Umbraco-CMS/issues/7194
is working on a reply...