AEM 6.2 extraClientlibs events get applied to ALL dialogs.

Avatar

Avatar

usmankhalidbutt

Avatar

usmankhalidbutt

usmankhalidbutt

18-08-2017

Hi there, I've been trying to figure this out for a couple of days.

I have component A and component B. I'm trying to add event listeners ONLY to the dialog for component A by adding the extraClientlibs property which references the custom clientlib on component A. As a test, it's just an alert that fires on dialog ready.

But what's happening is after the page loads in edit mode, if I open the dialog for component B first, alert doesn't fire, which is the expected behavior. Then, if I open up the dialog for component A, the alert pops up, and if open up the dialog for component B again after that, the alert fires, when it shouldn't. Basically, as soon as I open up the dialog for component A, component B starts getting the alert as well.

Does anyone have any idea what could be causing this?

Thanks

Replies

Avatar

Avatar

poojac35931336

Avatar

poojac35931336

poojac35931336

18-08-2017

Since you have written the alert on dialog ready it's getting invoked for both component.

For first time when it's not invoked for component B, it's might possible that function is not loaded in DOM yet and on opening the dialog of component A it's getting loaded.

Avatar

Avatar

usmankhalidbutt

Avatar

usmankhalidbutt

usmankhalidbutt

18-08-2017

I thought extraClientlibs only applied to the specific component that references that clientlib?

How can I invoke the alert on dialog ready only for component A?

Avatar

Avatar

poojac35931336

Avatar

poojac35931336

poojac35931336

19-08-2017

Try to write your function on some class specific to component A or id of component A only.