Expand my Community achievements bar.

SOLVED

To pass value of a field from page properties dialog to component dialog

Avatar

Level 9

Hi All,

Suppose in my page properties I have some custom tabs and there is a textfield in it.

In my component dialog, there is a text field which should be pre-populated with values from the above mentioned field. 

Tried with the below listener functions, but not working properly. 

function(box,val){var dlg = box.findParentByType('dialog');var sel = dlg.getField('./pagepropfield').getValue();var field = dlg.getField('./componentdialogfield');field.setValue(sel);}

function(comp) { var dlg = comp.findParentByType('dialog'); var sel = dlg.getField('./pagepropfieldl').getValue();alert(val); var field = dlg.getField('./componentdialogfield');field.setValue(sel);}

Any thoughts/pointers on this will be really helpful.

1 Accepted Solution

Avatar

Correct answer by
Administrator

As mentioned by Scott, 

You would need to write custom xtype, which will actually reads/fetches the page properties value from JCR node and set in to the dialog field.

Reference article to support your use-case:- http://stackoverflow.com/questions/21325733/pass-data-from-one-component-to-another-in-adobe-cq

//Pass data from one component to another in adobe CQ

    Only difference in your use-case is to fetch from page property.

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

2 Replies

Avatar

Level 10

You would need to write a custom xtype and in that xtype - which is just JS - retrieve the page props and then set the dialog fields. We have a article that shows you how to dynamically set fields in a dialog. 

http://helpx.adobe.com/experience-manager/using/dynamically-updating-aem-custom-xtype.html

The only difference from your use case is you want to read values from the page props - not from another dialog field. However - this points you in the right direction. 

Avatar

Correct answer by
Administrator

As mentioned by Scott, 

You would need to write custom xtype, which will actually reads/fetches the page properties value from JCR node and set in to the dialog field.

Reference article to support your use-case:- http://stackoverflow.com/questions/21325733/pass-data-from-one-component-to-another-in-adobe-cq

//Pass data from one component to another in adobe CQ

    Only difference in your use-case is to fetch from page property.

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni