Loaded unexpected element while trying to get rendering html from server. Expecting last tag to be closing script marker

If you have googled this error before, the most promising result is this article. Now this article does a good job of explaining what <code> elements are to the page-editor and their connection with this error and also proposes a solution that may or may not be the cause of the issue, in my case it wasn't.

Here is what my issue was:
  1. Working with Sitecore MVC view renderings
  2. A page has view renderings within nested placeholders, e.g. a hero slide item added to a hero slide item container with a placeholder (say hero-container), which in turn is added to the body of the page using another placeholder (say main-content).
  3. Using page editor, tried adding a new component to the leaf placeholder (say hero-container), and got the first popup for the allowed controls (if the field is populated)
  4. Once the component is selected and clicked Ok, nothing happens. Looking at the console I saw the following:

(I recommend you click on the link to the .js file and checkout the code to see exactly what the page-editor is looking for and how those <code> elements are being parsed.)

So, after spending a few hours and comparing components that worked with the ones that did not work in the page editor with similar nesting of placeholders, I found out that there is an easy work around. All you need to do is populate the "Datasource Location" field on the component and voila!! everything works. It's still a workaround and I am looking to create a ticket for Sitecore to look into this issue. Let me know if this worked for you or if you found other fixes or patches from Sitecore for this issue.


Popular posts from this blog

Is Rendered Item Valid XHtml Document Could not find schema information warnings during publish item Sitecore 7.2

RESOLVED: Solr Exceptions - Document contains at least one immense term in field

Sitecore Tabbed Select Rendering dialog