Image drag and drop in AEM 6.4 multifield component | Community
Skip to main content
Level 2
Jan 17, 2019 7:16 AM UTC
Solved

Image drag and drop in AEM 6.4 multifield component

Hello,

I am having trouble getting Image drag and drop working in a multi-field component in AEM 6.4. I am using sling:resourceType="granite/ui/components/foundation/form/fileupload".

                                        <bgimg

                                            jcr:primaryType="nt:unstructured"

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

                                            allowUpload="{Boolean}false"

                                            autoStart="{Boolean}false"

                                            class="cq-droptarget"

                                            fieldDescription="Select an image as background for the panel. Image height: 240px (min), 240px (max)."

                                            fieldLabel="Background Image"

                                            fileNameParameter="./hbgfileName"

                                            fileReferenceParameter="./hbgfileReference"

                                            mimeTypes="[image]"

                                            multiple="{Boolean}false"

                                            name="./file"

                                            required="{Boolean}true"

                                            title="Upload Image Asset"

                                            uploadUrl="${suffix.path}"

                                            useHTML5="{Boolean}true"/>

Based on suggestions I tried cq/gui/components/authoring/dialog/fileupload but neither of them work.

In neither of the cases do I see an image file drag and drop option.

Has anyone go this working successfully? Help will be appreciated,.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Gaurav-Behl
Gaurav-BehlAccepted solution
Level 10
Jan 17, 2019 12:11 PM UTC

Did you include cq:dropTargets node definition where you allow the mimetypes to be dropped?

Follow the dialog definition of /apps/core/wcm/components/image/v2/image and fix your code accordingly -

/apps/core/wcm/components/image/v2/image/cq:editConfig/cq:dropTargets

25 replies

Gaurav-Behl
Level 10
Jan 28, 2019 1:54 PM UTC

As mentioned earlier, if the dialog doesn't close then it's most likely a js conflict on the page. Please try the same dialog in a blank project/age and see if it works

If you are have sling:resourceSuperType property configured on the component, then it could be reason of missing inherited properties from  parent component.

you may try alternate resourceTypes to find the root cause -

Coral2 - granite/ui/components/foundation/form/fileupload

Coral3 -  cq/gui/components/authoring/dialog/fileupload or granite/ui/components/coral/foundation/form/fileupload

FileUpload — Granite UI 1.0 documentation

**The image in dialog doesn't render because my HTL script is blank.

Translate
sumits98596204
New Participant
Jan 28, 2019 4:37 AM UTC

Hi

After removing the property ,still no luck.

Now still dialog not closed of click of ok tick mark . No error in the console. I am working on AEM 6.4.0

Please share the vedio .

Translate
Gaurav-Behl
Level 10
Jan 25, 2019 4:19 PM UTC

Just delete uploadUrl property and test.

uploadUrl="${suffix.path}"

Works fine for me on 6.4.3 and core components 2.2.2 If you require, I can share a video of same.

uploadUrlstringel

The URL to upload the file. This is only required when autoStart is true.

Translate
sumits98596204
New Participant
Jan 25, 2019 11:56 AM UTC

Dialog Structure where products is a multifield node:

Please also find attached dialog xml .

<?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="63 Collapsible Multifield"

    sling:resourceType="cq/gui/components/authoring/dialog">

    <content

        jcr:primaryType="nt:unstructured"

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

                    <heading

                        jcr:primaryType="nt:unstructured"

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

                        fieldLabel="Heading"

                        name="./heading">

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

                            <h1

                                jcr:primaryType="nt:unstructured"

                                text="H1"

                                value="h1"/>

                            <h2

                                jcr:primaryType="nt:unstructured"

                                text="H2"

                                value="h2"/>

                            <h3

                                jcr:primaryType="nt:unstructured"

                                text="H3"

                                value="h3"/>

                            <h4

                                jcr:primaryType="nt:unstructured"

                                text="H4"

                                value="h4"/>

                            <h5

                                jcr:primaryType="nt:unstructured"

                                text="H5"

                                value="h5"/>

                            <h6

                                jcr:primaryType="nt:unstructured"

                                text="H6"

                                value="h6"/>

                        </items>

                    </heading>

                    <description

                        jcr:primaryType="nt:unstructured"

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

                        fieldDescription="Description"

                        fieldLabel="Description"

                        name="./description"/>

                    <fieldlabel

                        jcr:primaryType="nt:unstructured"

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

                        fieldDescription="Label text"

                        fieldLabel="Text Label"

                        name="./labeltext"/>

                    <show

                        jcr:primaryType="nt:unstructured"

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

                        fieldDescription="Use this key to fetch value from response"

                        name="./show"

                        text="Show Image"

                        value="{Boolean}true"/>

                    <products

                        jcr:primaryType="nt:unstructured"

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

                        composite="{Boolean}true"

                        eaem-show-on-collapse="EAEM.showProductName"

                        fieldLabel="Products">

                        <field

                            jcr:primaryType="nt:unstructured"

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

                            name="./products">

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

                                <column

                                    jcr:primaryType="nt:unstructured"

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

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

                                        <heroimage

                                            jcr:primaryType="nt:unstructured"

                                            sling:resourceType="cq/gui/components/authoring/dialog/fileupload"

                                            allowUpload="{Boolean}false"

                                            autoStart="{Boolean}false"

                                            class="cq-droptarget"

                                            fieldLabel="Hero Image"

                                            fileNameParameter="./fileName"

                                            fileReferenceParameter="./fileReference"

                                            mimeTypes="[image]"

                                            multiple="{Boolean}false"

                                            name="./image"

                                            uploadUrl="${suffix.path}"

                                            useHTML5="{Boolean}true"/>

                                        <productheading

                                            jcr:primaryType="nt:unstructured"

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

                                            fieldDescription="Enter Product Heading"

                                            fieldLabel="Product Heading"

                                            name="./productheading"/>

                                        <nestedfieldsets

                                            jcr:primaryType="nt:unstructured"

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

                                            composite="{Boolean}true"

                                            fieldLabel="Nested Items">

                                            <field

                                                jcr:primaryType="nt:unstructured"

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

                                                name="./nestedfieldset">

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

                                                    <column

                                                        jcr:primaryType="nt:unstructured"

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

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

                                                            <ischecked

                                                                jcr:primaryType="nt:unstructured"

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

                                                                fieldDescription="Use this key to fetch value from response"

                                                                name="./ischecked"

                                                                text="Is Checked"

                                                                value="{Boolean}true"/>

                                                            <link

                                                                jcr:primaryType="nt:unstructured"

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

                                                                fieldDescription="Select Path"

                                                                fieldLabel="Link"

                                                                name="./link"

                                                                rootPath="/content"

                                                                suffix=".html"/>

                                                        </items>

                                                    </column>

                                                </items>

                                            </field>

                                        </nestedfieldsets>

                                    </items>

                                </column>

                            </items>

                        </field>

                    </products>

                </items>

            </column>

        </items>

    </content>

</jcr:root>

No error in the console and dialog doesn't close on click of OK.

Translate
Gaurav-Behl
Level 10
Jan 25, 2019 11:36 AM UTC

Could you share the error details/screenshot/dialog.xml?

If it shows as disabled in the multifield then the most likely, the issue is with coral2-coral3 conflicts on the page.

Translate
sumits98596204
New Participant
Jan 25, 2019 9:37 AM UTC

Hi Team,

Please let me also know if anyone found the solution of using image field in multifield on AEM6.4.

I am also not able to find any solution

Thank you

Translate
Gaurav-Behl
Level 10
Jan 18, 2019 5:21 PM UTC

Could you share the screenshot of dialog here? Are you using coral2 or coral3 libraries for the entire page/project?

Are you on latest SP/CFP and core components?

Translate
Level 2
Jan 18, 2019 5:11 PM UTC

Hi, I was trying out different options, results seem to be the same with sling:resourceType="granite/ui/components/coral/foundation/form/fileupload".

Translate
Gaurav-Behl
Level 10
Jan 18, 2019 2:59 AM UTC

Is there any specific reason of using sling:resourceType="granite/ui/components/foundation/form/fileupload"

and not sling:resourceType="granite/ui/components/coral/foundation/form/fileupload"?

All other resourcetypes are of coral3 except fileupload.

Translate
Gaurav-Behl
Level 10
Jan 17, 2019 6:59 PM UTC

I'm able to reproduce the behavior that you mentioned and I plan to debug it later.

Check if this alternate solution suites your requirement-

Experiencing Adobe Experience Manager - Day CQ: AEM 62 - Touch UI Composite Image Multifield

It uses granite/ui/components/foundation/form/fileupload and works fine on 6.4.3

Translate