Solved
How to show or hide tab in dialog in cq5
Hi,
I have a requirement where based on radio button i need to show the tab when not selected i need to hide.
Please let me know how to achieve or examples please.
Hi,
I have a requirement where based on radio button i need to show the tab when not selected i need to hide.
Please let me know how to achieve or examples please.
By using the listener its quite easy to achieve your question.
Step 1: give the tab to show/hide an ID
<tab2 jcr:primaryType="cq:Panel" title="tab2" itemId="tab2"> ... </tab2>
Step 2: add a listener to the selection which you want to handle:
If the selection is 'no' the tab will be disabled, otherwise enabled.
<select jcr:primaryType="cq:Widget" fieldLabel="ShowTab" name="./show" type="radio" value="yes" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <option1 jcr:primaryType="nt:unstructured" text="Yes" value="yes"/> <option2 jcr:primaryType="nt:unstructured" text="No" value="no"/> </options> <listeners jcr:primaryType="nt:unstructured" selectionchanged="function( field,value, isChecked ){ if (field !=null){ var d = field.findParentByType('tabpanel'); if (value == 'no'){ d.hideTabStripItem('tab2'); }else{ d.unhideTabStripItem('tab2'); } } }"/> </select>Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.