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

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

  • March 11, 2016
  • 8 replies
  • 3793 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

akhilas82013436
New Participant
March 14, 2016

This worked :) Thanks a ton! 

edubey
New Participant
March 14, 2016

Check this image

 

akhilas82013436
New Participant
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. 

akhilas82013436
New Participant
March 14, 2016

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

akhilas82013436
New Participant
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.

edubey
edubeyAccepted solution
New Participant
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

smacdonald2008
New Participant
March 11, 2016
smacdonald2008
New Participant
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?