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

afteredit cq:listerner for page properties in Touch UI AEM 6.3

ybharath264
Level 2
Level 2

What event should I be using to handle the afteredit in the cq:listener for page properties.

1 Accepted Solution
Gaurav-Behl
Correct answer by
Community Advisor
Community Advisor

(function ($, $document) {

    "use strict";

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

                     // add the logic to run this code only for certain page/use case

                     // pick that specific pathfield/browser element and then you can get its value easily

                    // get the selected value and perform validations, if any

                    // populate other textfield/element based on some logic

         });

})($, $(document));

View solution in original post

5 Replies
Gaurav-Behl
Community Advisor
Community Advisor

could you share more details about your use case?

ybharath264
Level 2
Level 2

I have path field in one of my tabs in the page properties, Based on the input value of that field, I want to update a check box field in one of the other tabs in the page properties.

I tried to place this logic in a sling model, but the sling model is invoking only when the template (html) is called, meaning it works only when the page is open and I try to edit the properties. But If I directly edit the properties from Sites, the sling model will not invoke.  So trying to incorporate it into a cq:listener.

Gaurav-Behl
Community Advisor
Community Advisor

what would be the trigger for this listener? I doubt that pathfield can generate an event when a path is selected however, you could use the "select/Okay" button or dialog close event of the pathbrowser/pathfield to perform custom action.

How would you locate that pathfield/pathbrowser element unless you hardcode its id/class in some way for '/mnt/overlay/wcm/core/content/sites/properties.html?item= <something>'.  I assume that you plan to localize this implementation within your project.

may be use this class 'granite-pickerdialog-submit' for the trigger or use '<pathfield_element_container>.cq-dialog-submit' or 'dialog-closed' to write you code.

This example might help to get started - Experiencing Adobe Experience Manager - Day CQ: AEM 61 - Touch UI Rich Text Editor (RTE) Browse and ...

ybharath264
Level 2
Level 2

Hey Gaurab, Thank you for the insight.

I am trying this out with a authoring dialog clientlib.  But not sure how to get the Resource or Node values here if I take this approach. Any suggestions ?

(function ($, $document) {

    "use strict";

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

                    alert();

         });

})($, $(document));

Gaurav-Behl
Correct answer by
Community Advisor
Community Advisor

(function ($, $document) {

    "use strict";

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

                     // add the logic to run this code only for certain page/use case

                     // pick that specific pathfield/browser element and then you can get its value easily

                    // get the selected value and perform validations, if any

                    // populate other textfield/element based on some logic

         });

})($, $(document));

View solution in original post