Show-Hide in the multifield based on dropdown selection | Community
Skip to main content
May 24, 2023
Solved

Show-Hide in the multifield based on dropdown selection

  • May 24, 2023
  • 4 replies
  • 2449 views

Hi Guys

I have two fields

1. Dropdown with two options (1. type1, 2. type2)

2. Multifield with 4 items (item1, item2, item3, item4 ==> four items all are text fields)

 

case1: Now I want to show item2, item3 and item4 fields  when a content author select dropdown option as type1

 1. Dropdown(type1)

      2. Multifield

                   -item2

                   -item3

                   -item4

case2: I want to show item1 and item4 fields when a content author select dropdown option as type2

     1. Dropdown(type2)

      2. Multifield

                   -item1

                   -item4

 

Can someone please help me how to achieve this one
Thanks in advance 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
May 24, 2023
May 24, 2023

Thanks @arunpatidar  for the reply.

I have checked with above link. Above link is working when the dropdown is part of multifield. But here the dropdown field is separate from multifield. 

arunpatidar
Community Advisor
Community Advisor
May 25, 2023

In this case you need to write your own logic

Arun Patidar
Community Advisor
May 24, 2023
DPrakashRaj
Community Advisor
Community Advisor
May 25, 2023

Multifield fields only appear when click on add and if drop-down is out of multi-field so i believe it won’t work for hide-show with granite:data but just check if that’s not happening so you can follow this https://www.linkedin.com/pulse/aem-hideshow-drop-down-select-options-more-than-one-values-vikraman

but if it’s not working then simplest would be to maintain 2 separate multifield and as explained in above document to show his the multifield.

another option would be to write your own JavaScript and do the validation based on both drop-down value and click of multifield to show the field accordingly. I can’t find any document for this but will surely work 

sunil_kumar_
May 25, 2023

Hi @mahesh_tesla ,
What is your exact use case. Here can be two scenario. 
1. Hide/Show multifield items on dropdown item change. say, multifield has multiple items open however you want multifile item show/hide on dropdown.

2.  On multifield item add. say you have specific value on dropdown and based on selected dropdown value, multifield items will be visible. 
Which event trigger multifield item hide/show