Expand my Community achievements bar.

set jcr properties with js

Avatar

Former Community Member

Hi guys,

i'm using cq5.5 and i need to retrieve a property inside the loadcontent of a dialog, i can do it with the following code:

loadcontent="function(comp) {

   var properties = CQ.shared.HTTP.eval(CQ.shared.HTTP.noCaching(dlg.path+'.-1.json'));

   if(properties.myVar== undefined)

             properties.myVar= '0';

}"

Now i need to update the value of myVar and save it inside the jcr:content

Is there a way to do it?

I can create for example something like this (it is a pseudocode):

var panel = comp.findParentByType('panel');

var myVar = new CQ.form.TextField({

     type:textField,

     name:./myVar;

});

myVar.setValue('0');

myVar.hide();

panel.add(myVar);

but i suppose that exist a simpler way...

In particular i need also to set a property inside the parent page and i cant do it with the previous approach.

Thanks

0 Replies