Component specific dialog listeners in AEM 6.4/6.5 | Community
Skip to main content
Level 9
December 21, 2021
Solved

Component specific dialog listeners in AEM 6.4/6.5

  • December 21, 2021
  • 1 reply
  • 2210 views

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");
});



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 NitroHazeDev

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


@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']",

 

});

});

1 reply

Kishore_Kumar_
Level 9
December 21, 2021

Hi,

 

We can make use of extraClientlibs or includeclientlibs to load a dialog specific clientlibs.

 

https://wcmaem.blogspot.com/2016/08/how-to-load-touchui-dialog-specific.html?m=1

Level 9
December 21, 2021

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

NitroHazeDevAuthorAccepted solution
Level 9
December 21, 2021

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


@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']",

 

});

});