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

Content save issue in multifield

Avatar

Level 5

Hi, 

I am using custommultifield.js for the custom multifields inside my dialog. Here i am facing one issue with dialogfieldset widget. In JCR value of selectgrid is setting properly under node parsys --> gridslider --> options --> item_1 when i submitted the dialog.

But inside item_1 my other properties are not getting store like color1,position1. Below is my dialog.xml. Any Idea how can this will be get store or what will be the exact path to store them. 

<?xml version="1.0" encoding="UTF-8"?> <jcr:root 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="cq:Dialog" title="Slider" width="{Long}650" xtype="dialog"> <items jcr:primaryType="cq:Widget" xtype="tabpanel"> <items jcr:primaryType="cq:WidgetCollection"> <tab1 jcr:primaryType="cq:Panel" title="Slider"> <items jcr:primaryType="cq:WidgetCollection"> <typeconfigs jcr:primaryType="cq:Widget" fieldLabel="Select Videos" name="./options" xtype="customconfigmultifield"> <fieldConfigs jcr:primaryType="cq:WidgetCollection"> <gridlayout jcr:primaryType="cq:Widget" fieldLabel="Select the grid" itemId="dispotions" layout="hbox" name="selectgrid" type="radio" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <grid1 jcr:primaryType="nt:unstructured" text="grid1" value="grid1"/> </options> </gridlayout> <fieldset jcr:primaryType="cq:Widget" id="fieldset0" title="Optional Video" width="{Long}300" xtype="dialogfieldset"> <items jcr:primaryType="cq:WidgetCollection"> <colour jcr:primaryType="cq:Widget" fieldLabel="Colour" name="color1" type="select" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <one jcr:primaryType="nt:unstructured" text="Tangerine" value="tangerine"/> </options> </colour> <position jcr:primaryType="cq:Widget" fieldLabel="Position" name="position1" type="select" xtype="selection"> <options jcr:primaryType="cq:WidgetCollection"> <one jcr:primaryType="nt:unstructured" text="Top Left" value="top_left"/> </position> </items> </fieldset> </fieldConfigs> </typeconfigs> </items> </tab1> </items> </items> </jcr:root>

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

vdhim23 wrote...

Mshajiahmed wrote...

When you make changes to dialog fields, it makes an ajax request. What are the parameters being passed in ajax call

 

Hi, I checked the request parameters when i submitted the dialog, it seems like :

  1. ./options/item_1/selectgrid:
    grid1
  2. color1:
    red
  3. position1:
    top_right

Here i like to store color1 and position1 also inside item_1, something like ./options/item_1/color1 :red ,

Here item_1 is the node which dynamically generate by multifield when i add new section in multifield.

Any Idea how this can be done.

 

Thanks

 

 

If you want to store these values - write a custom sling servlet (or a custom OSGi service) that uses the JCR API to can create nodes, modify nodes, retrieve nodes and then store these values on the given nodes. Its much better to write your own AEM JCR services that can store and retrieve data from the AEM JCR. You have full control over how it works and meet your business requirements. 

Your component's JSP can retrieve the values entered into the multifield (the dialog) and then invoke the servlet and pass the values to store into the AEM JCR. 

View solution in original post

4 Replies

Avatar

Level 9

When you make changes to dialog fields, it makes an ajax request. What are the parameters being passed in ajax call

Avatar

Level 10

The values entered into the dialog can be retrieved from the component's JSP. If you want to post these values to an AEM servlet, write application logic in the component's JSP. 

To learn how to get the dialog values - see the example Hero Component in this article:

https://helpx.adobe.com/experience-manager/using/creating-aem-multifield-components.html

SO if you want to make an AJAX request with the dialog values, better to invoke a servlet directly from the JSP and pass the values retrieved from the dialog.

Here is another community article that shows a front end component (that uses an xtype) invoking a back end servlet:

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html

Avatar

Level 5

Mshajiahmed wrote...

When you make changes to dialog fields, it makes an ajax request. What are the parameters being passed in ajax call

 

Hi, I checked the request parameters when i submitted the dialog, it seems like :

./options/item_1/selectgrid:grid1 color1:red position1:top_right

 

  1.  

Here i like to store color1 and position1 also inside item_1, something like ./options/item_1/color1 :red , Here item_1 is the node which dynamically generate by multifield when i add new section in multifield. Any Idea how this can be done.

 

Thanks

Avatar

Correct answer by
Level 10

vdhim23 wrote...

Mshajiahmed wrote...

When you make changes to dialog fields, it makes an ajax request. What are the parameters being passed in ajax call

 

Hi, I checked the request parameters when i submitted the dialog, it seems like :

  1. ./options/item_1/selectgrid:
    grid1
  2. color1:
    red
  3. position1:
    top_right

Here i like to store color1 and position1 also inside item_1, something like ./options/item_1/color1 :red ,

Here item_1 is the node which dynamically generate by multifield when i add new section in multifield.

Any Idea how this can be done.

 

Thanks

 

 

If you want to store these values - write a custom sling servlet (or a custom OSGi service) that uses the JCR API to can create nodes, modify nodes, retrieve nodes and then store these values on the given nodes. Its much better to write your own AEM JCR services that can store and retrieve data from the AEM JCR. You have full control over how it works and meet your business requirements. 

Your component's JSP can retrieve the values entered into the multifield (the dialog) and then invoke the servlet and pass the values to store into the AEM JCR.