[AEM 6.3] AEM form components with data-sly-resource result javascript errors | Community
Skip to main content
Level 2
Jul 12, 2017 10:14 AM UTC
Solved

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

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.
viveksachdeva
viveksachdevaAccepted solution
New Participant
Jul 18, 2017 6:00 AM UTC

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

Level 2
Jul 24, 2017 8:32 AM UTC

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?

Translate
viveksachdeva
New Participant
Jul 21, 2017 7:27 AM UTC

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.

Translate
Level 2
Jul 20, 2017 7:15 AM UTC

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?

Translate
Level 2
Jul 19, 2017 9:32 AM UTC

when open the properties of the child component.

Translate
viveksachdeva
New Participant
Jul 19, 2017 9:29 AM UTC

when are you seeing this error?

Translate
Level 2
Jul 19, 2017 9:23 AM UTC

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.

Translate
viveksachdeva
viveksachdevaAccepted solution
New Participant
Jul 18, 2017 6:00 AM UTC

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

Translate
kautuk_sahni
Employee
Jul 13, 2017 11:11 AM UTC

Feike Visser​ any help here?

Translate
Kautuk Sahni
BenOeAuthor
Level 2
Jul 13, 2017 5:56 AM UTC

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.

Translate
smacdonald2008
Level 10
Jul 12, 2017 4:50 PM UTC

Can you drag your component from the side rail?

Translate