Coral Fileupload not working when placed inside Coral multi-field

Avatar

Avatar

pravinb2619228

Avatar

pravinb2619228

pravinb2619228

24-02-2018

I am working on a component which requires an image to be uploaded using fileupload widget inside a coral multi-field 

Following is the dialog configuration:

<?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="Custom Multi-field Component"

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

    <content

        jcr:primaryType="nt:unstructured"

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

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

            <tabs

                jcr:primaryType="nt:unstructured"

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

                maximized="{Boolean}true">

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

                    <generalItemsTab

                        jcr:primaryType="nt:unstructured"

                        jcr:title="General"

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

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

                            <content

                                jcr:primaryType="nt:unstructured"

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

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

                                    <title

                                        jcr:primaryType="nt:unstructured"

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

                                        fieldDescription="Please provide title for the component"

                                        fieldLabel="Title"

                                        name="./title"/>

                                    <image

                                        jcr:primaryType="nt:unstructured"

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

                                        allowUpload="{Boolean}false"

                                        autoStart="{Boolean}false"

                                        class="cq-droptarget"

                                        fieldLabel="Background Image"

                                        fileNameParameter="./imageFileName"

                                        fileReferenceParameter="./imageFileRef"

                                        mimeTypes="[image/jpeg,image/png]"

                                        multiple="{Boolean}false"

                                        name="./imageFile"

                                        title="Upload Image Asset"

                                        uploadUrl="${suffix.path}"

                                        useHTML5="{Boolean}true"/>

                                </items>

                            </content>

                        </items>

                    </generalItemsTab>

                    <productsTab

                        jcr:primaryType="nt:unstructured"

                        jcr:title="Products Tab"

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

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

                            <content

                                jcr:primaryType="nt:unstructured"

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

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

                                    <products

                                        jcr:primaryType="nt:unstructured"

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

                                        composite="{Boolean}true"

                                        fieldDescription="Click 'Add field' to add a new Product"

                                        fieldLabel="Products">

                                        <field

                                            jcr:primaryType="nt:unstructured"

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

                                            name="./multiFieldItems">

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

                                                <productName

                                                    jcr:primaryType="nt:unstructured"

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

                                                    fieldDescription="Please provide name for the Product"

                                                    fieldLabel="Product Name"

                                                    name="./productName"/>

                                                <productDesc

                                                    jcr:primaryType="nt:unstructured"

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

                                                    fieldDescription="Please provide Description for the Product"

                                                    fieldLabel="Product Description"

                                                    name="./productDesc"/>

                                                <productImage

                                                    jcr:primaryType="nt:unstructured"

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

                                                    allowUpload="{Boolean}false"

                                                    autoStart="{Boolean}false"

                                                    class="cq-droptarget"

                                                    fieldLabel="Product Image"

                                                    fileNameParameter="./productImageFileName"

                                                    fileReferenceParameter="./productImageFileRef"

                                                    mimeTypes="[image/jpeg,image/png]"

                                                    multiple="{Boolean}false"

                                                    name="./productImageFile"

                                                    title="Upload Product Image"

                                                    useHTML5="{Boolean}true"/>

                                            </items>

                                        </field>

                                    </products>

                                </items>

                            </content>

                        </items>

                    </productsTab>

                </items>

            </tabs>

        </items>

    </content>

</jcr:root>

Issue: When multiple product info is added in the "Products Tab"  of the dialog, the property "productImageFileRef" should be stored on each of the multi-field nodes. But that is not the case as you can see below:

Note: I have overridden the OOTB /libs/cq/gui/components/authoring/dialog/fileupload/render.jsp inside my project to fix one of the issues mentioned in this link

https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components/issues/101.

I have also referred the solution specified at http://experience-aem.blogspot.com/2016/06/aem-62-touch-ui-composite-image-multifield.html but that does not work in my case as I am using Coral widgets.

Environment : AEM 6.3.1.2

Any inputs from the community members would be appreciated.

Replies

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.8K

Likes

1.0K

Correct Reply

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.8K

Likes

1.0K

Correct Reply

1.1K
kautuk_sahni
Community Manager

26-02-2018

Can you check this with the package provided in this article:- Creating a Granite/Coral 6.3 Multifield HTL component for Adobe Experience Manager

smacdonald2008​ Can you check this as you have already worked on coral3 + Multi-field?

Avatar

Avatar

navinkaushal

Avatar

navinkaushal

navinkaushal

26-02-2018

I guess that while saving your node the order of saving is wrong. Please look into that.

Avatar

Avatar

pravinb2619228

Avatar

pravinb2619228

pravinb2619228

12-03-2018

Hi kautuksahni​/ navinkaushal

Thanks for your reply. I modified the multi-field in the article you mentioned by including the following file upload widget:

                            <cardImage

                                jcr:primaryType="nt:unstructured"

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

                                autoStart="{Boolean}false"

                                class="cq-droptarget"

                                fieldLabel="Background Image"

                                fileNameParameter="./cardImageFileName"

                                fileReferenceParameter="./cardImageFileRef"

                                mimeTypes="[image/jpeg,image/png]"

                                multiple="{Boolean}false"

                                name="./cardImageFile"

                                title="Upload Image Asset"

                                uploadUrl="${suffix.path}"

                                useHTML5="{Boolean}true"

                                allowUpload="{Boolean}false"/>

But the property cardImageFileRef is being stored at location "/content/mfCoral63/en/jcr:content/par/touchmulti" instead of on each of the following nodes:


"/content/mfCoral63/en/jcr:content/par/touchmulti/products/item0"

"/content/mfCoral63/en/jcr:content/par/touchmulti/products/item1"

navinkaushal​ : Can you please elaborate on your previous comment?

Thanks

Pravin

Avatar

Avatar

pawan_gupta

Avatar

pawan_gupta

pawan_gupta

15-08-2018

hello,

Did you find any solution for that because i am also facing same issue. I explored fileupload widget /libs/cq/gui/components/authoring/dialog/fileupload/render.jsp and found parameter "data-cq-fileupload-temporaryfilepath" is one of the key value which defines where to save node based on contextpath. The problem is it always returns component path as context path and that's why it stored there not at each iterative node like item0, item1 etc...

let me know if you have found any solution.

i also referred http://experience-aem.blogspot.com/2016/06/aem-62-touch-ui-composite-image-multifield.html

but not useful. it doesn't work at all.

thanks,

pawan

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

15-08-2018

What AEM version are you using?

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

15-08-2018

I will test this with the latest granite types and see if its working.

Avatar

Avatar

pravinb2619228

Avatar

pravinb2619228

pravinb2619228

15-08-2018

Hi smacdonald2008​, @pawan_gupta,

Following is the response from Adobe support when we raised a ticket with for this issue:

As per the internal bug created with the product team, this is a limitation that is being worked upon on at Internal Jira GRANITE-21310. Once the fix is done it would be back-ported to the next AEM 6.3 service pack release which can be tracked using  Adobe Experience Manager Help | AEM Maintenance Releases Roadmap .

Avatar

Avatar

ajay_uddaraju

Avatar

ajay_uddaraju

ajay_uddaraju

23-10-2018

Hello Pravin,

We are also facing similar issue. Is this resolved for you ?

If so can you throw some light here.

Avatar

Avatar

ashwinik6452226

Avatar

ashwinik6452226

ashwinik6452226

18-12-2018

HI

I am also facing issue when I put granite/ui/components/foundation/form/fileupload inside multifield. When I open dialog it is showing as some box.Please help on it.

(Using AEM6.4 and Sightly)

imagemultifield.png

imgmultifield.PNG