Page Editor JavaScript difficulties

When I was implementing the WeBlog module on one of my projects, I ran into a couple of strange JavaScript errors when using the Page Editor to insert components. I noticed two things about the issues:

  1. They only showed up on WeBlog pages
  2. They only showed up when I tried adding a component to any place except the top – if an existing component was there and I’d add it below it would work.

The errors:

When I clicked Component – Add to here in the Page Editor, I got one of the two following errors when I looked at them in Chrome:
Could not find the rendering in the HTML loaded from server
    Sitecore.PageModes.ChromeTypes.Placeholder.Sitecore.PageModes                                                                  .ChromeTypes.ChromeType.extend._frameLoaded


    Cannot find rendering chrome with unique id: 17A541CA4BC34DCBB60F783861BF3191

In addition to that, whenever I clicked anywhere on the page to change one of the renderings/ a piece of text, I also get:

Cannot parse command parameters

Whichever error I got, I would also get a JavaScript popping up saying:

An error ocurred.

I could however still change things around successfully, whether that’s adding or changing text, image, link or even changing a Datasource using ‘Edit the component properties’.

The solutions:

There were actually two issues I was dealing with here, not one:

  1. The first issue was known issue: The Page Editor did not save renderings inserted to a placeholder if the placeholder contained renderings that specified the placeholder key using mixed case. (367952)
    This issue was actually fixed in SItecore 6.6 Update 4 (as specified on SDN)
    After I changed my placeholder keys from camelcase to lowercase, the popup JavaScript error went away, as did the ‘Could not find the rendering in the HTML loaded from server’ error. The second issue remained, however.
  2. The second error is actually a bug (which has been registered with Sitecore Support).

So the first solution was reasonably simple, the second one a bit confusing. Here’s what was going on:

Widgets in WeBlog are based on the /sitecore/templates/Modules/WeBlog/Blog Sublayout template, rather than the default /sitecore/templates/System/Layout/Renderings/Sublayout template. This was so the output of the widgets can be cached per blog.

The Page Editor checks whether the template of the inserted control is the /sitecore/templates/System/Layout/Renderings/Sublayout template. If the control is not based on that template  the control can not be identified as a Sublayout.

Initially I changed the template of the widgets to the default, after that Sitecore Support did come back to me with a possible workaround: a changed version of the /sitecore/shell/Applications/Page Modes/Utility.js file. I have not implemented this (as I didn’t need the caching per blog), so that hasn’t been tested.

Big kudos to Sitecore Support for helping me figure out the cause for these problems.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.