How to read a page node (under content) through a dialog | Community
Skip to main content
New Participant
September 1, 2016
Solved

How to read a page node (under content) through a dialog

  • September 1, 2016
  • 1 reply
  • 885 views

Hi,

I have a requirement to build a form page with a drop down and  a rich text box. When user selects an option from Drop down, read a value from a page node (ex. content/mypage/jcr:content/node1) and assign it to the rich text box. When the user updates the rich text value and submits, it should update the existing page node value.

Can anyone please provide me an example or sample code?

Thanks in Advance.

Kishore

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 kautuk_sahni

Hi Kishore

Please have a look at this helpx article:- 

Link:-https://helpx.adobe.com/experience-manager/using/creating-touchui-dynamic.html

// This article covers Dynamically updating AEM TouchUI Dialog Select Fields   

So basically we are updating the values based on event listeners.  

        you can use the set options method of the selection xtype. Modify your listener to something like this

        dialogclose="function(pathfield){ 
                var dialog = pathfield.findParentByType('dialog');
                var selectBox = dialog.findByType('selection')[0]; //assuming this is the only selection you have
                $.getJSON('/bin/featuresservlet?path=' + this.value, function(jsonData){
                    selectBox.setOptions(jsonData);
                    selectBox.doLayout(flase,false);
                }); }" 
        The data returned by your servlet must be of the following format :

        [
         {
            "value": "valueOfOption1",
            "text": "textOfOption1"
         },
         {
            "value": "valueOfOption2",
            "text": "textOfOption2"
         }

        ]
Source:- http://stackoverflow.com/questions/25708043/populating-select-box-options-on-changing-pathfield-in-dialog-of-adobe-cq5/25772802#25772802

More Reference article :- http://jenikya.com/blog/2013/04/dynamic-dialog-data-in-cq5.html

~kautuk

1 reply

kautuk_sahni
kautuk_sahniAccepted solution
Employee
October 17, 2016

Hi Kishore

Please have a look at this helpx article:- 

Link:-https://helpx.adobe.com/experience-manager/using/creating-touchui-dynamic.html

// This article covers Dynamically updating AEM TouchUI Dialog Select Fields   

So basically we are updating the values based on event listeners.  

        you can use the set options method of the selection xtype. Modify your listener to something like this

        dialogclose="function(pathfield){ 
                var dialog = pathfield.findParentByType('dialog');
                var selectBox = dialog.findByType('selection')[0]; //assuming this is the only selection you have
                $.getJSON('/bin/featuresservlet?path=' + this.value, function(jsonData){
                    selectBox.setOptions(jsonData);
                    selectBox.doLayout(flase,false);
                }); }" 
        The data returned by your servlet must be of the following format :

        [
         {
            "value": "valueOfOption1",
            "text": "textOfOption1"
         },
         {
            "value": "valueOfOption2",
            "text": "textOfOption2"
         }

        ]
Source:- http://stackoverflow.com/questions/25708043/populating-select-box-options-on-changing-pathfield-in-dialog-of-adobe-cq5/25772802#25772802

More Reference article :- http://jenikya.com/blog/2013/04/dynamic-dialog-data-in-cq5.html

~kautuk

Kautuk Sahni