Dialog:
<type jcr:primaryType="cq:Widget" fieldLabel="Type" name="./type" type="radio" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <email jcr:primaryType="nt:unstructured" text="Email" value="email"/> <url jcr:primaryType="nt:unstructured" text="Url" value="url"/> </options> <listeners jcr:primaryType="nt:unstructured" selectionchanged="function(field,value) { MyDialog.setRequired(field,value); }"/> </type>
Listener JavaScript:
MyDialog.setRequired = function(field,value) { var dialog = field.findParentByType("dialog"), email = dialog.getField('./email1'); if('url' == value) { email.allowBlank = true; }else{ email.allowBlank = false; } };
I hope this will help you.
Thanks and regards
Kautuk Sahni