Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

cq5.5 cq:listeners not working

Avatar

Level 2

Hi,

I am trying to implement custom function to component's cq:listeners. I simply set the value of afteredit property to: function(){alert "something";}, but js didn't get worked when editing the custom component. Is it a bug of cq5.5?

Thanks and Regards,

Yy

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi 

I have even tried Link: https://helpx.adobe.com/experience-manager/using/dynamically-updating-aem-custom-xtype.html

Its working fine for me too.

And Supporting to the fact "For your example -  afteredit is a way to fire an event by defining a JCR node.  Its better to define an event with code using events defined in the AEM widgets API:

http://docs.adobe.com/content/docs/en/cq/5-6-1/widgets-api/index.html"

I hope this would help you.

Thanks and Regards

Kautuk Sahni

View solution in original post

0 Replies

Avatar

Level 2

I tried, but even REFRESH_PAGE didn't refresh the page. No matter what value I set for the actions (afteredit, afterinsert, etc), they always work like REFRESH_SELF.

Avatar

Level 10

Are you using script to define the event handlers, as shown here:

https://helpx.adobe.com/experience-manager/using/dynamically-updating-aem-custom-xtype.html

 

//DROP DOWN
this.linkType = new CQ.form.Selection({
            type:"select",
            cls:"customwidget-1",
            listeners: {
                selectionchanged: {
                    scope:this,
                    fn: this.updateHidden
                }
            },
            optionsProvider: this.optionsProvider
        });

Avatar

Level 2

I do use the sample in https://helpx.adobe.com/experience-manager/using/creating-aem-multifield-components.html to create custom components but I didn't use the way like scripts in that sample to deal with even listeners. I set cq:listeners "afteredit" value to the scripts which can do some stuff. The problem is those scripts didn't get fired. 

Avatar

Level 10

I will look into this and see if I can reproduce this issue. I will post back my findings. 

Avatar

Level 10

Events in 5.5 are firing. I have just tested and this was result:

As you can see - this fires when i select a drop-down item. The value is copied and placed into the text field. 

For your example -  afteredit is a way to fire an event by defining a JCR node.  Its better to define an event with code using events defined in the AEM widgets API:

http://docs.adobe.com/content/docs/en/cq/5-6-1/widgets-api/index.html

 

If you define event handler via a JCR node - i have found that events handlers defined in a JS script on a valid AEM widget works better. 

Avatar

Level 10

Hi, 

use beforesubmit listener on dialog, it's easy and works properly in 5.5

Avatar

Correct answer by
Administrator

Hi 

I have even tried Link: https://helpx.adobe.com/experience-manager/using/dynamically-updating-aem-custom-xtype.html

Its working fine for me too.

And Supporting to the fact "For your example -  afteredit is a way to fire an event by defining a JCR node.  Its better to define an event with code using events defined in the AEM widgets API:

http://docs.adobe.com/content/docs/en/cq/5-6-1/widgets-api/index.html"

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Avatar

Level 2

Yes, it works in the sample. The problem should be in my project which didn't have event listeners fired. Thank you very much for the help.