Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

multi select dropdown explaination

Avatar

Level 5

Hi,

can anyone explain to me how to deal with multi select dropdown i.e. in which we can select multiple values in one dropdown 

can anyone tell me the properties that need to be different than normal dropdown and how to store the output from the multi dropdown?

Capture.PNG

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi @rahul234dabas,

 

You can consider it be a string array, comma separated. You can refer the tag selection as well, when we use multiple tags to a resource, it is stored as String[] and this use case is analogous to it.

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

Hi @rahul234dabas,

 

You can consider it be a string array, comma separated. You can refer the tag selection as well, when we use multiple tags to a resource, it is stored as String[] and this use case is analogous to it.

Avatar

Community Advisor

@rahul234dabas As replied in the below thread, the same works for this case as well but only additional property you need to add is mutliple =true and the values will be stored in comma separated string. 

 

<datatype
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Select country"
multiple="true"
name="./country">
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/not-able-to-capture-words-... 

 Hope this helps.

Hi @Siva_Sogalapalli , I tried adding this property and got success but I am trying to get the string array values but getting failed. Please find the below snippet I used:

@ValueMapValue
private String[] fileType; 
private String fileTypeValues;
@PostConstruct
protected void fileExtanctions() { 
if (fileType != null && fileType.length > 0) {  
fileTypeValues = Arrays.stream(fileType).collect(Collectors.joining(", "));  
} else {  
fileTypeValues = "";  
}  
}
public String getFileTypeValues() {
return fileTypeValues;
}
But I am unable to get the string array initially. Can you please help me with this?