Pathbrowser and fileupload not working first time inside coral multifield ? | Community
Skip to main content
Level 2
September 19, 2017

Pathbrowser and fileupload not working first time inside coral multifield ?

  • September 19, 2017
  • 3 replies
  • 9178 views

Having a component with following cq:dialog.

After clicking add button in multi-filed, as expected i am getting Pathbrowser and fileupload field which is not working. if i close the dialog and open again both fields are started working (i can able to browse file and upload image).

1, Is it a bug ? or am i missing anything here ?

2, Pathbrowser or fileupload which is best to use for images ?

I understand the difference that in Pathbrowser we can restrict user to specific path, but user will not have image preview (am i correct ?)

<?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="Product Banner"

    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="Left Banner Box"

                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"

                                fieldLabel="Title"

                                name="./title"/>

                            <description

                                jcr:primaryType="nt:unstructured"

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

                                fieldLabel="Description"

                                name="./description"/>

                            <linktext

                                jcr:primaryType="nt:unstructured"

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

                                fieldDescription=" Link Text"

                                fieldLabel="Link Text"

                                name="./linktext"/>

                            <linkurl

                                jcr:primaryType="nt:unstructured"

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

                                fieldDescription="Link URL"

                                fieldLabel="Link URL"

                                name="./linkurl"/>

                        </items>

                    </columns>

                </items>

            </tab1>

            <tab2

                jcr:primaryType="nt:unstructured"

                jcr:title="Product Box List"

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

                <layout

                    jcr:primaryType="nt:unstructured"

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

                    margin="{Boolean}false"/>

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

                    <column

                        jcr:primaryType="nt:unstructured"

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

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

                            <list

                                jcr:primaryType="nt:unstructured"

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

                                composite="{Boolean}true"

                                fieldDescription="Click + to add a new list item"

                                fieldLabel="Product List"

                                name="./list">

                                <field

                                    jcr:primaryType="nt:unstructured"

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

                                    name="./items">

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

                                        <image

                                            jcr:primaryType="nt:unstructured"

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

                                            autoStart="{Boolean}false"

                                            class="cq-droptarget"

                                            fieldLabel="Product Image"

                                            fileNameParameter="./fileName"

                                            fileReferenceParameter="./fileReference"

                                            mimeTypes="[image]"

                                            multiple="{Boolean}false"

                                            name="./file"

                                            title="Upload Image Asset"

                                            uploadUrl="${suffix.path}"

                                            useHTML5="{Boolean}true"/>

                                        <title

                                            jcr:primaryType="nt:unstructured"

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

                                            fieldLabel="Product Title"

                                            name="./productTitle"/>

                                        <description

                                            jcr:primaryType="nt:unstructured"

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

                                            fieldLabel="Description"

                                            name="./description"/>

                                        <linktext

                                            jcr:primaryType="nt:unstructured"

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

                                            fieldDescription=" Link Text"

                                            fieldLabel="Link Text"

                                            name="./linktext"/>

                                        <linkurl

                                            jcr:primaryType="nt:unstructured"

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

                                            fieldDescription="Link URL"

                                            fieldLabel="Link URL"

                                            name="./linkurl"/>

                                    </items>

                                </field>

                            </list>

                        </items>

                    </column>

                </items>

            </tab2>

        </items>

    </content>

</jcr:root>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Manjunath_DJ
Level 2
September 19, 2017

Hi

Can you check console errors when dialog is breaking/not opening and try adding listener after edit so page refresh happens.

Console error could help to know whats breaking in the java script .

Check the below links for Touch multi field Dialog

Adobe Experience Manager Help | Creating an AEM 6.2 HTML Template Language component that uses a Multi-Field dialog

viswacAuthor
Level 2
September 19, 2017

Hi

There is no problem in opening dialog. Dialog works perfectly, problem only in multi-field.

There no error related to this issue in the console.

Manjunath_DJ
Level 2
September 19, 2017

Hi

I have implemented multi field as per the blog it works perfectly fine. can you go thru blog once upload demo package and try it

Which version of AEM are you using?

benoitl54314939
September 19, 2017

I have the same issue.

Fileupload or pathbrowser are not working in the multifield.  Pathfield is ok.

It's rendered properly but when dragging an asset on the fileupload nothing happens.

If I move my fileupload node outside of the multifield it works. 

I'm running aem 6.3 with sp2.

viswacAuthor
Level 2
September 20, 2017

Exactly 

smacdonald2008
Level 10
September 20, 2017

Just tried adding a file upload to a MF 6.3 dialog and it works:

As you can see - we can drag an image onto it.

You can try this too. Load the package from this artilce on 6.3:

Scott's Digital Community: Creating an Adobe Experience Manager Newsletter HTL component

Copy the file node and paste under the MF dialog. Open the example page and open the dialog - you will see the FIleUpload and you can drag images onto it. Now - you would need to change the Java code to make it render in the page - but the file upload does work in a MF.

viswacAuthor
Level 2
September 25, 2017

Thanks, i will try this. I have few questions.

1, if multi-field has more number of fields, it will become hard to author(lot to scroll). How to solve this ?

2, Is there an option to put separator(line) after each field-set in multi-field ?

3, Is multi-field good approach to add more records dynamically into the page by author ?

4, I have a path-field inside multi-field and author can enter external url (http:.//something.com) or choose an aem page. Problem is i have to check if it's external or internal and if it internal, i need to add ".html" ? (by default i am getting like "/content/myapp/myhome" and it's not working without adding .html)

If i need to add ".html" how to do that in js use api ?

     var contactLinkResource = resource.getChild(CONST.CONTACT_LINKS);

     var items = contactLinkResource.listChildren();

     // i need to loop here and get item.purl and check if external or internal based on that add ".html"?

     // I can do this java, but how to do this js use api ?