Skip to main content
akhilas82013436
Level 2
Mar 11, 2016 9:06 AM UTC
Solved

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

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.
edubey
edubeyAccepted solution
Level 10
Mar 11, 2016 7:11 PM UTC

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
Mar 11, 2016 3:01 PM UTC

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

Translate
smacdonald2008
Level 10
Mar 11, 2016 7:10 PM UTC
edubey
edubeyAccepted solution
Level 10
Mar 11, 2016 7:11 PM UTC

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

Translate
akhilas82013436
Level 2
Mar 14, 2016 11:15 AM UTC

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.

Translate
akhilas82013436
Level 2
Mar 14, 2016 11:36 AM UTC

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

Translate
akhilas82013436
Level 2
Mar 14, 2016 11:41 AM UTC

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. 

Translate
edubey
Level 10
Mar 14, 2016 12:00 PM UTC

Check this image

 

Translate
akhilas82013436
Level 2
Mar 14, 2016 12:42 PM UTC

This worked :) Thanks a ton! 

Translate