cq5.5 cq:listeners not working | Community
Skip to main content
New Participant
November 9, 2015
Solved

cq5.5 cq:listeners not working

  • November 9, 2015
  • 9 replies
  • 3182 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

9 replies

y_12Author
New Participant
November 11, 2015

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.

kautuk_sahni
kautuk_sahniAccepted solution
Employee
November 10, 2015

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

Kautuk Sahni
edubey
New Participant
November 10, 2015

Hi, 

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

smacdonald2008
New Participant
November 9, 2015

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. 

smacdonald2008
New Participant
November 9, 2015

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

y_12Author
New Participant
November 9, 2015

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. 

smacdonald2008
New Participant
November 9, 2015

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
        });
y_12Author
New Participant
November 9, 2015

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.

Lokesh_Shivalingaiah
New Participant
November 9, 2015