AEM6.3 Touch ui autocomplete coral tags storing as String instead of String[] required for classic dialog | Community
Skip to main content
srinivas_chann1
Level 7
July 31, 2019
Solved

AEM6.3 Touch ui autocomplete coral tags storing as String instead of String[] required for classic dialog

  • July 31, 2019
  • 2 replies
  • 2695 views

Hi ,

We are using  AEM6.3 both classic and touch ui dialog.

When using the below autocomplete for tags it storing in crxde as string instead of string[] when i just select one tag .Due to this when i open the same in classic dialog the tags don't come up as it expects String[].

Please could you provide inputs as how to fix it.

The component i am using is

<tag

         jcr:primaryType="nt:unstructured"

         sling:resourceType="granite/ui/components/coral/foundation/form/autocomplete"

         fieldLabel=" Asset Tags"

          multiple="{Boolean}true"

         name="./assetTags"

         mode="contains">

          <datasource

           jcr:primaryType="nt:unstructured"

           sling:resourceType="cq/gui/components/common/datasources/tags"/>

          <options

           jcr:primaryType="nt:unstructured"

           sling:resourceType="granite/ui/components/coral/foundation/form/autocomplete/list"/>

          <values

           jcr:primaryType="nt:unstructured"

           sling:resourceType="granite/ui/components/coral/foundation/form/autocomplete/tags"/>

                                    </tag>

Classic UI:-

Touch UI:-

I am selecting just one tag it stores as  assetTags String instead od String[]

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

Hi srinivas channappa​,

This works for me although I tested in AEM 6.4

Parallel to your tag node create another node called tag-hint with same name as the original node followed by "@TypeHint" as shown below:

                         <tag-hint

                               jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/coral/foundation/form/hidden"

                               value="String[]"

                                ignoreData="{Boolean}true"

                                name="./assetTags@TypeHint">

                            </tag-hint>

As mentioned in the documentation:

@TypeHint

Parameters with the @TypeHint suffix may be used to force storing the named parameter in a property with the given type. The value of the @TypeHint parameter, if applied to a parameter for a property, is the JCR property type name. If the @TypeHint parameter is applied to a field upload parameter, the value is used to indicate the JCR primary node type for the node into which the uploaded file is stored.

If the @TypeHint value ends with [], it indicates a multi-value property. A multi-value property is usually auto-detected if there are multiple values for the property (i.e. request parameter). But if only a single value is present in the request, the desired property type needs to be explicitly defined as multi-value by stating @TypeHint=<type>[].

For more info check this:

https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#typehint

https://www.argildx.com/technology/how-to-change-data-type-typecast-in-aem-use-typehint

2 replies

rampai
Community Advisor
rampaiCommunity AdvisorAccepted solution
Community Advisor
July 31, 2019

Hi srinivas channappa​,

This works for me although I tested in AEM 6.4

Parallel to your tag node create another node called tag-hint with same name as the original node followed by "@TypeHint" as shown below:

                         <tag-hint

                               jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/coral/foundation/form/hidden"

                               value="String[]"

                                ignoreData="{Boolean}true"

                                name="./assetTags@TypeHint">

                            </tag-hint>

As mentioned in the documentation:

@TypeHint

Parameters with the @TypeHint suffix may be used to force storing the named parameter in a property with the given type. The value of the @TypeHint parameter, if applied to a parameter for a property, is the JCR property type name. If the @TypeHint parameter is applied to a field upload parameter, the value is used to indicate the JCR primary node type for the node into which the uploaded file is stored.

If the @TypeHint value ends with [], it indicates a multi-value property. A multi-value property is usually auto-detected if there are multiple values for the property (i.e. request parameter). But if only a single value is present in the request, the desired property type needs to be explicitly defined as multi-value by stating @TypeHint=<type>[].

For more info check this:

https://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html#typehint

https://www.argildx.com/technology/how-to-change-data-type-typecast-in-aem-use-typehint

srinivas_chann1
Level 7
July 31, 2019

Thanks for helping me out on fixing this issue.