How to get same field on selection of two values in dropdown? | Community
Skip to main content
amangoyal15
Level 3
December 13, 2016

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

  • December 13, 2016
  • 3 replies
  • 11711 views

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.

3 replies

smacdonald2008
Level 10
December 13, 2016

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

amangoyal15
Level 3
December 14, 2016

I am using AEM 6.1 - Touch UI

codingStar
Level 3
March 17, 2017
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>           
smacdonald2008
Level 10
December 13, 2016

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, 

amangoyal15
Level 3
December 14, 2016

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) 

amitaj56771832
March 20, 2017

hello aman,

have you resolved this issue?

sandeepm744005
Level 5
March 20, 2017

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