Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Multifield data not stored in JSON format

Avatar

Level 4

Hi All,

I have created a multifield component in touch ui after adding the values to dialog the content stored in zcrx is not in JSON format it is in below array format.

Can some one please suggest on this.

1356486_pastedImage_4.png

Thanks

Sahil Garg

1 Accepted Solution

Avatar

Correct answer by
Level 10

See this article - it tells you everything you need to do - including how to download the ACS-COmmons package -- Creating an AEM HTML Template Language 6.3 component that uses a Multifield

View solution in original post

12 Replies

Avatar

Level 7

Hi,

Please refer the link below. It might help you in achieving your requirement (store values in JSON format). The aim of the below tutorial is to store and retrieve the values in the form of JSON Array from crxde/JCR repository.

http://www.aemcq5tutorials.com/tutorials/touchui-multifield-component-using-htl/

Please let us know if you still face any difficulty in implementing this.

We hope this information helps!

Regards,

TechAspect Solutions

Avatar

Level 4

HI TechAspect,

I have already tried that, in this blog they have mentioned that by using the property on fieldset acs-common-nested="" will store the data in JSON  format but in my case i have already declared this property but still it is saving in String[] format for all the fields individually. can you please suggest.

Thanks

Avatar

Level 7

Hi,

We were sucessfully able to implement your use case by following the link that we had mentioned earlier. It's working fine for us.

However, we've uninstalled acs-commons package and see that the values are getting saved in String[] format. So possible reason behind your issue is, you might not have acs-commons package installed.

Try installing acs-commons package. This should resolve your issue.

We hope this helps!

Regards,

TechAspect Solutions

Avatar

Level 4

Hi TechAspect,

yes i haven't installed the acs-commons package can you please share the link to download this package and how can i install this. Do i need to simply install this from package manger.

Thanks in advance.

Avatar

Level 4

Please share your dialog structure.

try use ACS commons multifieldpanel xtype

Avatar

Level 7

Hi,

Here is the link to download acs-commons package:

https://adobe-consulting-services.github.io/acs-aem-commons/

Once you download the package, you can simply upload and install it from package manager.

We hope this helps!

Regards,

TechAspect Solutions

Avatar

Level 4

Hi Tech Aspect,

I have tried to download and install the acs-commons package but still same issue persists.Can you please help me on this. Can you please help me to convert my cq:dialog node to xml format so that i can share the same with you.

Thanks

Avatar

Correct answer by
Level 10

See this article - it tells you everything you need to do - including how to download the ACS-COmmons package -- Creating an AEM HTML Template Language 6.3 component that uses a Multifield

Avatar

Level 10

The data will be stored as JSON--

JCRNodes.png

Avatar

Level 1

Does the same apply to classic UI as well or is there any different approach?

Avatar

Level 1

I am trying to switch from Classic UI (ACS Commons Multi Field Panel) To Coral Touch UI and am following the demo linked above but the data is getting saved to the JCR as a String Array for each item under the multi field instead of saving them all under the same property.

You can see below that they are getting stored as flag, link, and title. Instead of being stored as JSON under myUserSubmenu

EDIT: I am running AEM 6.5 and ACS Commons 4.0

Capture.PNG

This is the Dialog I am using.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/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="User Menu"
   sling:resourceType="cq/gui/components/authoring/dialog">

   <content
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <layout
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/layouts/tabs"
   type="nav"/>

   <items jcr:primaryType="nt:unstructured">

   <tabs
   jcr:primaryType="nt:unstructured"
   jcr:title="General"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <usersubmenu
   jcr:primaryType="nt:unstructured"
   jcr:title="User Submenu"
   sling:resourceType="granite/ui/components/foundation/section">

   <layout
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>

   <items jcr:primaryType="nt:unstructured">

   <tab
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <usersubmenudetails
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/multifield"
   class="full-width"
   fieldDescription="Click 'Add field' to add a new User Submenu title and links"
   fieldLabel="User Submenu Items">

   <field
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/fieldset"
   acs-commons-nested=""
   name="./myUserSubmenu">

   <layout
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
   method="absolute"/>

   <items jcr:primaryType="nt:unstructured">

   <column
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">

   <items jcr:primaryType="nt:unstructured">

   <title
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/textfield"
   fieldDescription="Enter User Submenu title"
   fieldLabel="User Submenu Title"
   name="./title"/>

   <link
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
   fieldDescription="Enter User Submenu Link"
   fieldLabel="User Submenu Link"
   name="./link"
   rootPath="/content"/>

   <flag
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/checkbox"
   checked="{Boolean}false"
   fieldDescription="Testing Flag for checkbox"
   name="./flag"
   text="Flag"
   title="Checkbox Tooltip"/>

   </items>

   </column>

   </items>

   </field>

   </usersubmenudetails>

   </items>

   </tab>

   </items>

   </usersubmenu>

   </items>

   </tabs>

   </items>

   </content>

</jcr:root>

Avatar

Level 1

I am running into the same issue as you. I am running AEM 6.5 and acs 4.3.2.


@smacdonald2008 or anyone else at Adobe, is it possible to store the values as json on AEM 6.5?