Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Triggering clientlibs specific to dialog in both classic and touch ui dialogs

Avatar

Level 2

So, if i have to add a custom xtype or custom validation for my dialog or anything that would require me to create a clientlibs for the particular dialog, setting categories to cq.widgets for classic ui and cq.authoring.dialog for touch ui, How would i ensure that the scripts i add in this clientlibs is not used by any other dialog but this one. As it causes problems, because similar triggers are applicable to all the dialogs which hampers the working of other dialogs as the functions are global.

In short, How do i restrict the clientlibs to only the dialog it is meant for. (for both touch and classic keeping cq.authoring.dialog and cq.widgets  categories respectively)

3 Replies

Avatar

Administrator

Check this post:- load clientLib based on components(CQ.AUTHORING.DIALOG GETS LOADED ON ALL THE PAGES OR ALL THE PROJE...

// Creating a new clientlibrary named custom.authoring.dialog and including it by using extraClientLibs in your components

   OR

   Use cq:includeClientLib with a new category

For Dialog validation see this:- AEM Touch UI Custom Validation - Adobe Experience Manager | AEM/CQ | Apache Sling

~kautuk



Kautuk Sahni

Avatar

Level 2

Thanks Kautuk.

I have already gone through that link. The extra clientlibs property works only for touch ui dialogs. What if i have created a custom xtype for my classic dialog and need to put that in a specific clientlib folder rather than giving the category as cq.widgets.

I tried using cq:include as well. Doesn't work. Please suggest a solution for classic ui dialogs.

Avatar

Community Advisor

You can always create a clientlib and include it in edit mode only.. For example, create a clientlib names "cq.authoring" include it in your page only for edit mode... it will have a JS function which will only be called by your dialog in any of the callback method like blur or whatever.... Or what you can do is have your JS inline in the callback/listeners