Expand my Community achievements bar.

SOLVED

not able to capture words after space in coral/select(dropdown)

Avatar

Level 5

Hi, I am facing issue while capturing value from dropdown in AEM.

The value are stored but the words after space is ignored.

 

e.g.- If "united states" is selected then only "united" is stored in the variable and "states" is ignored

please help me find the cause of it and how to fix it 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

I am using acs commons generic list to populate options within coral3 dropdown.

 

Here is my touch ui country field node -

 

DEBAL_DAS_0-1647451861498.png

 

datasource node -

DEBAL_DAS_1-1647451909539.png

 

Generic list options [Key, value pairs] -

DEBAL_DAS_2-1647451981685.png

 

Based on selection united states/south korea is getting persisted as shown below -

 

DEBAL_DAS_3-1647452089566.png

DEBAL_DAS_4-1647452160582.png

 

I believe you are populating the options using datasource, then please let us know what are you getting against 'value' key as shown below -

 

DEBAL_DAS_5-1647452445123.png

 

 

 

 

View solution in original post

3 Replies

Avatar

Community Advisor

@rahul234dabas , I would suggest to use values without spaces in it but it should still work with spaces.

 

Please find below sample dialog.xml and it works for me. 

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Test Component"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs">
<items jcr:primaryType="nt:unstructured">
<noAgents
jcr:primaryType="nt:unstructured"
jcr:title="Test"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<datatype
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
fieldLabel="Select country"
name="./dataType">
<items jcr:primaryType="nt:unstructured">
<usa
jcr:primaryType="nt:unstructured"
text="United States"
value="united states"/>
<germany
jcr:primaryType="nt:unstructured"
text="Germany"
value="germany"/>
</items>

</datatype>

</items>
</column>
</items>
</noAgents>
</items>
</content>
</jcr:root>

Saved Data: 

 

Siva_Sogalapalli_0-1647432945831.png

 

Hope this helps. 

Avatar

Level 5

sorry @Siva_Sogalapalli this is not what I am looking for ....I am populating dropdown values dynamically and from there on the values after spaces are being ignored...the way that you have showed works perfectly but I am looking for something else. 

Thank you

Avatar

Correct answer by
Employee Advisor

I am using acs commons generic list to populate options within coral3 dropdown.

 

Here is my touch ui country field node -

 

DEBAL_DAS_0-1647451861498.png

 

datasource node -

DEBAL_DAS_1-1647451909539.png

 

Generic list options [Key, value pairs] -

DEBAL_DAS_2-1647451981685.png

 

Based on selection united states/south korea is getting persisted as shown below -

 

DEBAL_DAS_3-1647452089566.png

DEBAL_DAS_4-1647452160582.png

 

I believe you are populating the options using datasource, then please let us know what are you getting against 'value' key as shown below -

 

DEBAL_DAS_5-1647452445123.png