How to get the parent node name in dialog listener of its child node | Community
Skip to main content
akhilas82013436
Level 2
March 11, 2016
Solved

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

  • March 11, 2016
  • 8 replies
  • 3804 views

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.

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

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

8 replies

smacdonald2008
Level 10
March 11, 2016

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

smacdonald2008
Level 10
March 11, 2016
edubey
edubeyAccepted solution
Level 10
March 11, 2016

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

akhilas82013436
Level 2
March 14, 2016

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.

akhilas82013436
Level 2
March 14, 2016

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

akhilas82013436
Level 2
March 14, 2016

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. 

edubey
Level 10
March 14, 2016

Check this image

 

akhilas82013436
Level 2
March 14, 2016

This worked :) Thanks a ton!