Expand my Community achievements bar.

Converting listeners in AEM 6.4

Avatar

Level 3

As per the Adobe release notes, the listeners are not supported in AEM 6.4. Any listeners that needs to be converted to AEM 6.4 from lower versions (5.6) should be handled by creating customer clientlibs.

I'm relatively new to AEM and hence would need help along with example to know how this can be taken care.

In my AEM 5.6 listener, i have a JCR property called selectionChanged which has a value as function which calls a java script function.

Anyone who has implemented this, can you please guide me with the step by step process of handing and implementing similar functionality in AEM 6.4. do we need listener node created under cq:dialog? Which all properties need to be defined.

Thank you in advance.

5 Replies

Avatar

Level 10

Here is an older community article written by one of our Touch UI experts that can help you with this -- http://experience-aem.blogspot.com/2015/04/aem-6-sp2-touchui-adding-dynamic-select-options.html

Avatar

Level 10

However - the Granite Resource types by default do not support an event model that you can use to develop listeners.

Avatar

Employee Advisor

Can you please explain what you mean with "listener"? There are many different types of "listeners" around in the AEM tech stack, so a disambiguation would be really helpfull. When you mention "release notes", can you add the relevant URL?

Thanks,

Jörg

Avatar

Level 10

Joerg - i believe this community member means an event model for Granite Resource types

Avatar

Employee

In Aem 5.6 there was an option to execute listeners in the node itself something like this

1624106_pastedImage_0.png

To implement this in Aem 6.4 you needto create a clientlib folder and write the code in the javascript.

Create a folder with a name and add a property named as categories and give some category name

1624107_pastedImage_1.png

Add a folder named as js and another file named as js.txt .In the folder named as js add a file with some name something like shown in the screenshot

1624108_pastedImage_2.png.

In the js.txt add the name of the jsfile something like

#base=js

ccdtopicpage.js

Make sure you add the categories name in the cq:dialog node with the property name as extraClientlibs

1624109_pastedImage_3.png

Now how to write selectionChanged. So basically this refers to the event that when something is changed.

For example a checkbox when the checkbox is checked or unchecked you can write something like

var submitCheckValue = $(".navcheckclass")[0];

if(submitCheckValue.onchange = function ()

            {

             //doSomething

            });

where submitCheckValue is the graniteClass name.

And you dont need to add the listeners node in Aem 6.4 .Whatever is there in listener node convert that to javascript and write it under the clientlib folder.

Let me know if you need anything else.