Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How to get same field on selection of two values in dropdown?

Avatar

Level 3

Hi,

        I want to show same field on selection of more than one value in drop down.

Suppose in dropdown, we have A,B,C,D

and i have one seperate node say 'title'

I want to show this field when i select A and when i select B. 

As showhidetargetvalue is single valued property. i am not able to make it for multi value. 

I tried to make string[] for showhidetargetvalue, but it is working only for one value .

 

please assist.

10 Replies

Avatar

Level 10

What AEM version are you using and is your component meant for TOuch UI or Classic UI? 

Avatar

Level 3

smacdonald2008 wrote...

What AEM version are you using and is your component meant for TOuch UI or Classic UI? 

 

Touch UI

Avatar

Level 4
hi @amangoyal15, try below solution for AEM touchUI dialog
<nodeType jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="cq-dialog-dropdown-showhide" cq-dialog-dropdown-showhide-target=".list-option-listtype-showhide-target" fieldLabel="Node Type" name="./nodeName" value=""> <items jcr:primaryType="nt:unstructured"> <A jcr:primaryType="nt:unstructured" text="A" value="ab"/> <B jcr:primaryType="nt:unstructured" text="B" value="ab"/> <C jcr:primaryType="nt:unstructured" text="C" value="cd"/> <D jcr:primaryType="nt:unstructured" text="D" value="cd"/> </items> </nodeType> <setAB jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container" class="assettype-option-listtype-showhide-target foundation-layout-util-vmargin" showhidetargetvalue="ab"> <items jcr:primaryType="nt:unstructured"> <abSection jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/well"/> <items jcr:primaryType="nt:unstructured"> <textField jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" fieldDescription="Enter the First Name here." emptyText="Enter the First Name here." fieldLabel="First Name" name="./firstName" /> </items> </abSection> </items> </setAB> <setCD jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container" class="assettype-option-listtype-showhide-target foundation-layout-util-vmargin" showhidetargetvalue="cd"> <items jcr:primaryType="nt:unstructured"> <cdSection jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/well"/> <items jcr:primaryType="nt:unstructured"> <path jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" fieldLabel="Select Path" name="./path" rootPath="/content/dam"/> </items> </cdSection> </items> </setCD>           

Avatar

Level 1

How can 2 options of dropdown have same value?suppose,if we want to use that dropdown value somewhere else.

Avatar

Level 10

Can you post a screenshot of what you have now and what you want it to look like. It may help the community better understand you objective, 

Avatar

Level 3

see , In My dialog - there are only three widgets - choose (dropdown), name (textfield), pathselect (pathbrowser).

  • In dropdown - there are 4 options A,B,C,D.  (In properties, i have added 

                                                                class  = cq-dialog-dropdown-showhide

     
      cq-dialog-dropdown-showhide-target   =   .list-option-listfrom-showhide-target )
 
  • Textfield would be displayed on selection of  A or B.             ( showhidetargetvalue      string         a)   
  • Pathbrowser would be displayed on selection of  C or D.    ( showhidetargetvalue      string        c) 

I want to make them work for both values.

I tried by making string as a string[] type and tried to give multi value , it is accepting but then it is not even working for any single value.  like - ( showhidetargetvalue      string[]         a,b)     and         ( showhidetargetvalue      string[]         c,d) 

Avatar

Level 1

Hi @amangoyal15 , @amitaj56771832 

Please let me know if you got the solution. I'm also looking for the same.

Avatar

Level 5

Have you looked into this link already ?

http://stackoverflow.com/questions/25244844/conditional-show-hide-of-fields-in-aem-6-dialogs

Take a look at the base implementation that you are refering to that can be found here: /libs/cq/gui/components/authoring/dialog/dropdownshowhide/clientlibs/dropdownshowhide.js