Expand my Community achievements bar.

how to persist value of cq multifield component if hidden

Avatar

Level 2

hi

I am not able to render multifield to its actual state. it is rendered to its default state.

Scenario - 

In dialog, I am having two radio buttons and on basis of them i show/hide multifield component and dialogfield set. now when i am on radio button 1 - (multifield comp visible) and clicking on 'ok' of dialog it is rendering properly. and when i again open dialog. values are still there and multifield is open with item.

now when i click on radio button 2 - (multifield hidden and dialogfield set visible), now when i click 'ok' , dialogfield set values are rendered properly. but when i open dialog and go to radio button 1 - (multifield comp visible) , now the multifield is not coming as open i.e. it is not rendered to its saved state . it is coming to its default state. I need to shown the multifield where i have left. Please help.

Please see below code:

 

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0"     xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="cq:Dialog" xtype="dialog"> <items jcr:primaryType="cq:Widget" xtype="tabpanel"> <items jcr:primaryType="cq:WidgetCollection"> <tab1 jcr:primaryType="cq:Panel" title="abcd"> <items jcr:primaryType="cq:WidgetCollection"> <abcd jcr:primaryType="cq:Widget" name="./abcd" type="radiogroup" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <radio1 jcr:primaryType="cq:Widget" text="abcd" value="1"/> <radio2 jcr:primaryType="cq:Widget" text="abcd" value="2"/> </options> <listeners jcr:primaryType="nt:unstructured" selectionchanged="function(comp, val, isChecked) { var panel = comp.findParentByType("panel"); var a= panel.getComponent("abcd");var types = [];if(a){$.each(a.options, function(key,obj){types.push(obj.value);    });} showHideElements(val);   function showHideElements(a) {  types.forEach(function(type){    if(type === a) {        panel.getComponent(type).show();    }      else panel.getComponent(type).hide();   });  }"/> </abcd> <comp1 jcr:primaryType="cq:Widget" name="./abcd" width="{Long}1000" xtype="[multifield]"> <fieldConfig jcr:primaryType="cq:Widget" layout="form" name="./abcd" xtype="customPanel"> <items jcr:primaryType="cq:WidgetCollection"> <dial1 jcr:primaryType="cq:Widget" xtype="dialogfieldset"> <items   jcr:primaryType="cq:WidgetCollection"> textfield goes here </items> </dial1> </items> </fieldConfig> </comp1> <comp2 jcr:primaryType="cq:Widget" name="./abcd" xtype="panel"> <items jcr:primaryType="cq:WidgetCollection"> <dial2 jcr:primaryType="cq:Widget" xtype="dialogfieldset"> <items jcr:primaryType="cq:WidgetCollection"> textfield goes here </items> </dial2> </items> </comp2> </items> </tab1> </items> </items> </jcr:root>
2 Replies

Avatar

Level 10

Hi,

Are you able to see these values in JCR content?

Can you please share screenshot of your component,

Thanks

Avatar

Level 2

yes. I am content folder, I am able to see screenshot the values. sorry, not able to send screenshot due to client restriction.