Converting listeners in AEM 6.4

nileshdchavan 29-06-2018

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.

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)

Answers (5)

Answers (5)

devisreer29
Employee
17-11-2018

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.

Jörg_Hoh
Employee
29-06-2018

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