Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

(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

Avatar

Level 10

could you share more details about your use case?

Avatar

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.

Avatar

Level 10

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 ...

Avatar

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

Avatar

Correct answer by
Level 10

(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));