user2930621
user2930621

Reputation: 17

How to set the page properties values under a node in the currentpage

I need to set the cq:tags which is configured in page properties of the page to a node (jcr:content/samplenode). I overlay the page component but I didn't find the code to customize. How to set the page properties values under a node in the currentpage ?

Upvotes: 0

Views: 2805

Answers (1)

rakhi4110
rakhi4110

Reputation: 9281

If you want to save the value of the default tag field in the page properties at jcr:content/samplenode/cq:tags instead of jcr:content/cq:tags, then change the value for the property "name" in the tags widgets from ./cq:tags to ./samplenode/cq:tags

For the default page component, the tag widget can be found at the location /libs/foundation/components/page/tab_basic/items/basic/items/tags.

EDIT:

Though i wouldn't suggest the following approach, inorder to achieve your required functionality, along with the above mentioned changes, add a beforesubmit event listener to the dialog with the value set to the following function.

function(comp){
    var response = CQ.HTTP.get(CQ.WCM.getPagePath() + '/_jcr_content/samplenode.json');
    if(!CQ.HTTP.isOk(response)) {
        comp.getField('./samplenode/cq:tags').name = 'cq:tags';
    }
}

The dialog listener is to be added as shown in the picture below. enter image description here

Upvotes: 1

Related Questions