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
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.2 extraClientlibs events get applied to ALL dialogs.

Avatar

Avatar
Validate 1
Level 2
usmankhalidbutt
Level 2

Likes

4 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
usmankhalidbutt
Level 2

Likes

4 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
usmankhalidbutt
Level 2

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
Validate 1
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

8 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

8 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
poojac35931336
Level 3

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
Validate 1
Level 2
usmankhalidbutt
Level 2

Likes

4 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
usmankhalidbutt
Level 2

Likes

4 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
usmankhalidbutt
Level 2

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
Validate 1
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

8 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 3
poojac35931336
Level 3

Likes

20 likes

Total Posts

50 posts

Correct Reply

8 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
poojac35931336
Level 3

19-08-2017

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