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

Avatar

Avatar

Jarflux

Avatar

Jarflux

Jarflux

12-07-2017

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

viveksachdeva

Avatar

viveksachdeva

viveksachdeva

17-07-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) {

Answers (9)

Answers (9)

Avatar

Avatar

christofhed3545

Avatar

christofhed3545

christofhed3545

24-07-2017

error-message.png

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?

Avatar

Avatar

viveksachdeva

Avatar

viveksachdeva

viveksachdeva

21-07-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.

Avatar

Avatar

christofhed3545

Avatar

christofhed3545

christofhed3545

20-07-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?

Avatar

Avatar

christofhed3545

Avatar

christofhed3545

christofhed3545

19-07-2017

when open the properties of the child component.

Avatar

Avatar

viveksachdeva

Avatar

viveksachdeva

viveksachdeva

19-07-2017

when are you seeing this error?

Avatar

Avatar

christofhed3545

Avatar

christofhed3545

christofhed3545

19-07-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.

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.5K

Likes

955

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.5K

Likes

955

Correct Answer

1.1K
kautuk_sahni
Community Manager

13-07-2017

Feike Visser​ any help here?

Avatar

Avatar

Jarflux

Avatar

Jarflux

Jarflux

12-07-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.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

12-07-2017

Can you drag your component from the side rail?