Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Issue with persisting dialog values with multifield drop down field inside

Avatar

Level 2

Hi,

We are having a multifield with a dropdown selection(AssetType)  having 3 values(Image,DAM Video,Youtube video) inside the multifield.

When we select the image in the drop down, image related multifield container fields will get displayed and two containers(DAM Video and Youtube Video) will be hidden. Now we will author the image related fields.

Next we will be adding one more multifield item by selecting the drop down as "youtube" now youtube related multifield container fields will get displayed and two containers(DAM Video and Image) will be hidden. Now we will author the Youtube video related fields.

Dialog properties are getting stored on the page as below.

{"assetType":"image","imagePath":"/content/dam/images/IMG-NeilHausmann-Profile-0.97_1-2018-13.jpg","altText":"Neil Hausman Headshot","imageTitle":"Test","imageCaption":"Test","imagecopyright":"Test","videoPath":"","videoTitleS7":"","videoDescriptionS7":"","videoThumbnailS7":"","videoId":"","videoTitle":"","videoDescription":"","videoThumbnail":""}

{"assetType":"youtube","imagePath":"","altText":"","imageTitle":"","imageCaption":"","imagecopyright":"","videoPath":"","videoTitleS7":"","videoDescriptionS7":"","videoThumbnailS7":"","videoId":"test","videoTitle":"Test ","videoDescription":"Test","videoThumbnail":""}

Now when we open the authored dialog on the page values are not displaying the authored values.

PFB dialog

<?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="Gallery Image"

    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">

            <tab1

                jcr:primaryType="nt:unstructured"

                jcr:title="Gallery Image Details"

                sling:resourceType="granite/ui/components/foundation/container">

                <layout

                    jcr:primaryType="nt:unstructured"

                    sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>

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

                    <columns

                        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="Component Title"

                                fieldLabel="Component Title"

                                maxlength="{Long}100"

                                name="./title"/>

                            <introtext

                                jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/foundation/form/textarea"

                                fieldDescription="Component Intro Text"

                                fieldLabel="Component Intro Text"

                                maxlength="{Long}400"

                                name="./introText"

                                required="{Boolean}true"/>

                            <gallery

                                jcr:primaryType="nt:unstructured"

                                sling:resourceType="granite/ui/components/foundation/form/multifield"

                                fieldLabel="Asset List"

                                minItems="1">

                                <field

                                    jcr:primaryType="nt:unstructured"

                                    sling:resourceType="granite/ui/components/foundation/form/fieldset"

                                    acs-commons-nested=""

                                    name="./gallery">

                                    <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"

                                            assetfieldstobepopulated="\{&quot;imageAltText&quot;:&quot;./altText&quot;}"

                                            class="assetMetadataClass">

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

                                                <assetType

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/select"

                                                    class="cq-dialog-dropdown-showhide-multi assetType"

                                                    cq-dialog-dropdown-showhide-target=".assetType-option-listtype-showhide-target"

                                                    fieldDescription="Select the Asset Type."

                                                    fieldLabel="Asset Type"

                                                    name="./assetType"

                                                    required="{Boolean}true"

                                                    value="">

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

                                                        <image

                                                            jcr:primaryType="nt:unstructured"

                                                            text="Image"

                                                            value="image"/>

                                                        <scene7

                                                            jcr:primaryType="nt:unstructured"

                                                            text="Scene7"

                                                            value="scene7"/>

                                                        <youtube

                                                            jcr:primaryType="nt:unstructured"

                                                            text="YouTube"

                                                            value="youtube"/>

                                                    </items>

                                                </assetType>

                                                <imageUrl

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="corteva/components/content/contextualpathbrowser"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin"

                                                    contentRootPath="/content/dam/dpagco"

                                                    fieldLabel="Select Image Path"

                                                    name="./imagePath"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="image"/>

                                                <imageAltText

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Image Alt Text"

                                                    fieldLabel="Image Alt Text"

                                                    name="./altText"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="image"/>

                                                <imageTitle

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldLabel="Image Caption Title"

                                                    maxlength="{Long}87"

                                                    name="./imageTitle"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="image"/>

                                                <imagecaption

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textarea"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Image Caption Description"

                                                    fieldLabel="Image Caption Description"

                                                    maxlength="{Long}55"

                                                    name="./imageCaption"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="image"/>

                                                <imagecaptioncopyright

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textarea"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Image Caption Copyright"

                                                    fieldLabel="Image Caption Copyright"

                                                    maxlength="{Long}250"

                                                    name="./imagecopyright"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="image"/>

                                                <videoPath

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="corteva/components/content/contextualpathbrowser"

                                                    assetfieldstobepopulated="\{&quot;videoTitle&quot;:&quot;./videoTitleS7&quot;, &quot;videoDescription&quot;:&quot;./videoDescriptionS7&quot;, &quot;videoAltText&quot;:&quot;./videoAltTextS7&quot;, &quot;videoImage&quot;:&quot;./videoThumbnailS7&quot;}"

                                                    class="isMandatory assetMetadataClass assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    contentRootPath="/content/dam/dpagco"

                                                    fieldDescription="Select the Scene7 Video path."

                                                    fieldLabel="Video Path"

                                                    fieldstobepopulated="\{&quot;jcr:title&quot;:&quot;./title&quot;}"

                                                    name="./videoPath"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="scene7"/>

                                                <videoTitle

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Provide video title."

                                                    fieldLabel="Video Title"

                                                    maxlength="{Long}50"

                                                    name="./videoTitleS7"

                                                    showhidecustomtargetvalue="scene7"/>

                                                <videoDescription

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textarea"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Provide video description."

                                                    fieldLabel="Video Description"

                                                    name="./videoDescriptionS7"

                                                    showhidecustomtargetvalue="scene7"/>

                                                <videoThumbnail

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="corteva/components/content/contextualpathbrowser"

                                                    class="isMandatory assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    contentRootPath="/content/dam/dpagco"

                                                    fieldDescription="Provide video thumbnail image URL. "

                                                    fieldLabel="Video Thumbnail Image"

                                                    name="./videoThumbnailS7"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="scene7"/>

                                                <videoId

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    class="js-focus-out isMandatory assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Enter Video Id."

                                                    fieldLabel="Video Id"

                                                    name="./videoId"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="youtube"/>

                                                <Youtube_x0020_videoTitle

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textfield"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Provide video title."

                                                    fieldLabel="Video Title"

                                                    maxlength="{Long}50"

                                                    name="./videoTitle"

                                                    showhidecustomtargetvalue="youtube"/>

                                                <Youtube_x0020_videoDescription

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="granite/ui/components/foundation/form/textarea"

                                                    class="assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    fieldDescription="Provide video description."

                                                    fieldLabel="Video Description"

                                                    name="./videoDescription"

                                                    showhidecustomtargetvalue="youtube"/>

                                                <Youtube_x0020_videoThumbnail

                                                    jcr:primaryType="nt:unstructured"

                                                    sling:resourceType="corteva/components/content/contextualpathbrowser"

                                                    class="isMandatory assetType-option-listtype-showhide-target foundation-layout-util-vmargin hide"

                                                    contentRootPath="/content/dam/dpagco"

                                                    fieldDescription="Provide video thumbnail image URL. "

                                                    fieldLabel="Video Thumbnail Image"

                                                    name="./videoThumbnail"

                                                    required="{Boolean}false"

                                                    showhidecustomtargetvalue="youtube"/>

                                            </items>

                                        </column>

                                    </items>

                                </field>

                            </gallery>

                        </items>

                    </columns>

                </items>

            </tab1>

        </items>

    </content>

</jcr:root>

Thanks & Regards,

Kalyan

3 Replies

Avatar

Employee Advisor

Need more details on the setup. Can you log a daycare ticket with reproducible steps and share the component package?

That should be the quickest way to resolve this issue.

Avatar

Employee Advisor

Try to test on the latest SP/CFP level of whatever AEM version you are using since there were few known issues with multifield.

Avatar

Employee

Alternatively you can see the following article where it uses Coral multi-field components for similar purpose:

Creating a Granite/Coral 6.3 Multifield HTL component for Adobe Experience Manager