[AEM 6.3] AEM form components with data-sly-resource result javascript errors | Community
Skip to main content
Level 2
July 12, 2017
Solved

[AEM 6.3] AEM form components with data-sly-resource result javascript errors

  • July 12, 2017
  • 10 replies
  • 4695 views

I'm trying to build a component that consists of multiple other components without duplication of code.

So I tried to build an empty component that contains a data-sly-resource to include another component

<div data-sly-resource="${'path/to/resource' @ resourceType='my/resource/type'}"></div>

This resulted in a component that can be dragged from the sidekick and is rendered correctly.
But when I try to click the component to configure the the component, instead of showing the black edit bar it throws the javascript error below.

Uncaught TypeError: Cannot read property ‘hideTitle’ of undefined

   at hideTitleExists (form.js:2430)

   at guidetouchlib.editToolbar.appendButton (form.js:2461)

   at core.js:23633

   at Array.forEach (<anonymous>)

   at guidetouchlib.editToolbar.render (core.js:23632)

   at guidetouchlib.editToolbar.render (form.js:2538)

   at guidetouchlib.editToolbar.open (core.js:9645)

   at HTMLDocument.<anonymous> (core.js:9385)

   at HTMLDocument.dispatch (jquery.js:5226)

   at HTMLDocument.elemData.handle (jquery.js:4878)

The included component is working perfectly on its own.

I have tried to add a data-sly-unwrap, without any succes

Steps to replicate this issue:
- Install AEM 6.3
- Install Adobe Forms packages ( adobe-aemfd-osx-pkg-4.0.74.zip )

- Restart AEM to complete Adobe Forms installation
- Install custom content package containing 2 components and a test form ( demo-form-sly-resource.zip - Google Drive )
- Go to test form containing the 2 components http://localhost:4502/editor.html/content/forms/af/blank-test-form.html
- Open javascript console in developer tools
- Click on child component to validate the edit bar appears
- Click on the parent component to trigger the javascript error that prevents the edit bar from appearing

Kind Regards,

Ben

Het bericht is bewerkt door: Ben Oeyen
Added steps to replicate this issue.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by viveksachdeva

For parent component, the editable DOM points one level down(guideNode) than what it should point to(guide), causing this JS error.

Can be fixed by changing line 100 in /etc/clientlibs/fd/af/guideTouchAuthoringEditLayer/javascript/GuideTouchAuthoringCustomToolbar.js..

Currently it is:

        if (authoringConfigJson.hideTitle) {

Change it to:

        if (authoringConfigJson && authoringConfigJson.hideTitle) {

10 replies

smacdonald2008
Level 10
July 12, 2017

Can you drag your component from the side rail?

BenOeAuthor
Level 2
July 13, 2017

Yes, it's still possible to drag the components to the page.
Only clicking on the component in the page to configure it, will result in the error and no edit bar showing.

kautuk_sahni
Community Manager
Community Manager
July 13, 2017

Feike Visser​ any help here?

Kautuk Sahni
viveksachdeva
Community Advisor
viveksachdevaCommunity AdvisorAccepted solution
Community Advisor
July 18, 2017

For parent component, the editable DOM points one level down(guideNode) than what it should point to(guide), causing this JS error.

Can be fixed by changing line 100 in /etc/clientlibs/fd/af/guideTouchAuthoringEditLayer/javascript/GuideTouchAuthoringCustomToolbar.js..

Currently it is:

        if (authoringConfigJson.hideTitle) {

Change it to:

        if (authoringConfigJson && authoringConfigJson.hideTitle) {

Level 2
July 19, 2017

This indeed worked but now I receive this error

guideTouchAuthoringDialog.js:1344 Uncaught TypeError: Cannot read property ‘hasOwnProperty’ of undefined

    at Object.guidetouchlib.editLayer.dialogUtils.enableVisibleOnLoad (guideTouchAuthoringDialog.js:1344)

    at eval (eval at <anonymous> (eval at guidetouchlib.editLayer.dialogUtils.getExpression (guideTouchAuthoringDialog.js:149)), <anonymous>:1:41)

    at eval (eval at guidetouchlib.editLayer.dialogUtils.getExpression (guideTouchAuthoringDialog.js:149), <anonymous>:3:24)

    at guideTouchAuthoringDialog.js:186

    at coralui2.js:35240

And adding two child components with data-sly-resource doesn't seems to work. You can only get the properties of the last child component. Getting the properties of the first child component is impossible. It is not clear is has something to do with the mentioned error.

viveksachdeva
Community Advisor
Community Advisor
July 19, 2017

when are you seeing this error?

Level 2
July 19, 2017

when open the properties of the child component.

Level 2
July 20, 2017

I was able to call the properties of the child component by adding a div-tag around dala-sly-resource. The div-tag contains the guideConstants.GUIDE_FIELD_WIDGET constant.

Now we receive a 404 error from the child.component.af.somprovider when we call the som expression via the toolbar.

Do we need add or change something so that we can receive the som expression?

viveksachdeva
Community Advisor
Community Advisor
July 21, 2017

Strange enough I dont see an error when clicking on Edit... I can edit but while saving it throws some error in the backend, which seems unrelated to this.

Level 2
July 24, 2017

This is the error that I receive when selecting the properties of the child component.

The reason why I don't receive any SOM expression is because the child components don't exist beneath the parent component in CRX.

Is there a way to add the child component beneath the parent component? So we can call the SOM expression?