Listener in multi field
I am trying to use a listener for a selection inside the multifieldset , E.g Following code snippet will be wrapped under the multi field.
<multifieldSet>
<option
jcr:primaryType="cq:Widget"
name="option"
type="select"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<image
jcr:primaryType="nt:unstructured"
text="Image"
value="image"/>
<video
jcr:primaryType="nt:unstructured"
text="video"
value="video"/>
</options>
<listeners
jcr:primaryType="nt:unstructured"
loadcontent="function(box,value){
if (this.getValue() == 'image'){
alert('image');
// hide Text box 1
}else {
// hide Text box 2
}
}"
selectionchanged="function(box,value){
if (this.getValue() == 'image'){
// hide Text box 1
}else {
// hide Text box 2
}
}"/>
</mediaOption>
<text1
jcr:primaryType="cq:Widget"
name="text1"
xtype="textfield"/>
<text2
jcr:primaryType="cq:Widget"
name="text2"
xtype="textfield"/>
<multifieldSet>
Can anybody please tell which API should be used and how to use them to handle the logic