Unable to edit locked pages due to javascript error

Matt-H-

08-02-2019

AEM 6.3, Touch UI. I have a simple template and page component, described in detail at Layout Mode Not Showing Up. When a page using that template is locked, the page cannot be edited, due to a javascript error:

core.js-error.png

Once this error occurs, the globalbar buttons, like Edit, Preview, Unlock, and Page Information are all non-functional.

I have seen it happen with other templates too, sometimes with the same error happening in page.js

In this particular example, the page template component looks like this:

<html>
<%@include file="/libs/foundation/global.jsp" %>
<cq:include script="/libs/wcm/core/components/init/init.jsp"/>
  <body>
    <cq:include path="" resourceType="/libs/foundation/components/title"/>
    <h3>Layout:</h3>
    <cq:include path="pagecontent/layout" resourceType="wcm/foundation/components/responsivegrid"/>
  </body>
</html>

I've also seen templates where this doesn't happen (like the We.Retail pages), so something is clearly missing in these templates.

Does anyone know what I need to do, or what needs to be in this template to avoid this error?

Accepted Solutions (1)

Accepted Solutions (1)

Answers (6)

Answers (6)

PuzanovsP

MVP

11-02-2019

Hey Matt,

Thanks for asking this question,

You are missing an include from OOTB AEM that would normally allow you to unlock this page.

Check OOTB site how's it's implemented and add missing clientlibs to your project.

P.S. this does happen on auto generated projects as they do miss that clientlib import, which causes this exact issue.

Regards,

Peter

Matt-H-

10-02-2019

No, this is not about editing a page by another author. This is about the fact that after the static is locked, if I, the admin and owner of the page, go into that page to edit it, I am unable to edit it or unlock it or preview it, because the global bar functions no longer work. When the page loads and AEM's javascript runs, it gets a javascript error that kills the rest of the javascript functionality: "Uncaught TypeError: Cannot read property 'shared' of undefined" from core.js at line 33981.

core.js-error2.png

It will even happen on a very simple static template:

<html>

    <body>

        <h1>Hello world.</h1>

    </body>

</html>

Using this as the page component, if you edit the page, lock the page then reload the page, the javascript error happens and the global bar buttons don't work.

helloworld.png

It does not happen on all pages, clearly. But it is happening on this page with this template component. So the other pages must be doing something or loading some library that mine does not.

smacdonald2008

10-02-2019

As Gaurav asked - if the page is locked - are you expecting to be able to edit it by another author? A locked page cannot be edited by another author. 

Gaurav-Behl

MVP

10-02-2019

Do you mean that the author should be able to edit a page locked by some other author? Refer - Page Properties Edit Issue

We-Retail uses Editable templates -Page Templates - Editable 

Are you talking about 'editable feature in lock mode' (probably a bug) or the 'responsive mode feature' of static templates vs editable templates?