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

SOLVED

Component specific dialog listeners in AEM 6.4/6.5

Avatar

Level 9

Hello All,

 

Is there a way to have component specific dialog listeners ? I have a clientlibrary created with categories cq.authoring.dialog and a function on save of dialog. This however gets invoked on every dialog save. How could i make it component specific?

Usecase would be i want to validate if the droptarget has an image set


$(document).on("click", ".cq-dialog-submit", function (e) {

alert("hello !on submit");
});



1 Accepted Solution

Avatar

Correct answer by
Level 9

@Kishore_Kumar_  Used something like this with validate at droptarget and it applied to that component itself on 64..Thanks for the help. I would definitely try your approach on 65 since i like to use dialog functions

(function(ns, $, $document){
$(window).adaptTo("foundation-registry").register("foundation.validation.validator",{

selector: "[data-validation='xxx-validation']",

 

});

});

View solution in original post

5 Replies

Avatar

Level 9

Thanks for the response but i am not sure i understand. Is this compatible with 6.4 or 6.5? And my use case would be to validate if on save of the dialog, the droptarget has an image or not set for that component.

Update putting in extraclientlibs in 6.4 just brings up validation for every component dialog save @Kishore_Kumar_ 

 

please let me know

Avatar

Community Advisor

Hi @NitroHazeDev ,

 

We have to use custom clientlibs category name (not cq.authoring.dialog) and add in extraClientlibs property.

Avatar

Level 9

I thought that did it but clearing the cache that did not work. Set the extraclientlibs at cq:dialog node with another clientlibrary and also added the script to the JS .But on save the dialog is invoked for any component not just the one we want to @Kishore_Kumar_ 

I am on 6.4

Avatar

Correct answer by
Level 9

@Kishore_Kumar_  Used something like this with validate at droptarget and it applied to that component itself on 64..Thanks for the help. I would definitely try your approach on 65 since i like to use dialog functions

(function(ns, $, $document){
$(window).adaptTo("foundation-registry").register("foundation.validation.validator",{

selector: "[data-validation='xxx-validation']",

 

});

});