Expand my Community achievements bar.

SOLVED

How to get the parent node name in dialog listener of its child node

Avatar

Level 2

In a parsys section we can place a component placeholder. On editing the component placeholder a dialog box will appear to which a listener is configured. Is there a way for the listener to know in which parsys the component placeholder is being placed?

Note: Parent node of component placeholder is the parsys node

Purpose: Based on which parsys the component placeholder is located I need to validate entries in the dialog of the component placeholder. The listener passes the values entered in dialog box to a servlet where the validation happens and if valid the component placeholder will display the component.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Use path property for dialog object

function(dialog){

console.log(dialog.path);

}

https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.Dialog

View solution in original post

8 Replies

Avatar

Level 10

SO you are looking for a way to dynamically get the path of a component (a placeholder) that you drop into an AEM page? 

Avatar

Correct answer by
Level 10

Use path property for dialog object

function(dialog){

console.log(dialog.path);

}

https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.Dialog

Avatar

Level 2

smacdonald2008 wrote...

SO you are looking for a way to dynamically get the path of a component (a placeholder) that you drop into an AEM page? 

 

Yes exactly.

Avatar

Level 2

Thank you! I am trying to get the same value in AEM 6 inside dailog listener.

Avatar

Level 2

edubey wrote...

Use path property for dialog object

function(dialog){

console.log(dialog.path);

}

https://docs.adobe.com/docs/en/cq/5-6/widgets-api/index.html?class=CQ.Dialog

 

Thank you! Tried this but it says "dialog undefined". Any idea where do I define it or to which node(s) it can be used? The dialog node which I am using is having an xtype:dialog and jcr:primaryType as cq:Dailog.