cq:listener - afteredit listener custom value | Community
Skip to main content
Level 2
January 4, 2018
Solved

cq:listener - afteredit listener custom value

  • January 4, 2018
  • 5 replies
  • 5267 views

Hi All,

My requirement : I have a component which accepts some text say "#abc" as a dialog property. The current page URL, say "http://localhost:4502/content/xyz.html", has to be appended with the dialog property value as "http://localhost:4502/content/xyz.html#abc" before the page gets refreshed after edit of the dialog. So, when we close the dialog editor the page should get refreshed with the appended URL and not the initial page URL.

Is there a way to define a custom value for the afteredit cq:listener where i can define my javascript logic? or any other approach to achieve this functionality?

Any help is appreciated.

Thanks in advance.

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 edubey

1. have a clientlibs with category cq.authoring.dialog

2. Add a js file with this wrapper code - It defines the base for listener, you should be able to place your code here.

(function ($, $document) {

   

    $document.on("dialog-ready", function() {

        // Dialog is loaded

    });

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

        // Dialog submit event

    });

})($, $(document));

5 replies

edubey
Level 10
January 4, 2018

classic or touch ui?

S_BhavyaAuthor
Level 2
January 4, 2018

would like to implement on both

S_BhavyaAuthor
Level 2
January 4, 2018

I was able to implement it on classic UI using the beforesubmit listener on the dialog, defining the logic using JS. However, could anyone please direct me to the right documentation talking about dialog listeners for Touch UI. A generalized guide may be?

edubey
edubeyAccepted solution
Level 10
January 4, 2018

1. have a clientlibs with category cq.authoring.dialog

2. Add a js file with this wrapper code - It defines the base for listener, you should be able to place your code here.

(function ($, $document) {

   

    $document.on("dialog-ready", function() {

        // Dialog is loaded

    });

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

        // Dialog submit event

    });

})($, $(document));

S_BhavyaAuthor
Level 2
January 4, 2018

Thank you!! that works!