Expand my Community achievements bar.

SOLVED

Multi field collapses after submit

Avatar

Level 3

Hello Community,

 

I am not able to read the values of a multi field while the dialog submit event, below is the example before dialog submission.

the can be accessed using jQuery but,

 

VinodNE_0-1683474059828.png

 

after the dialog is submitted the field collapses and the DOM objects and the values are not available. Below is the example after dialog submit.

VinodNE_1-1683474734727.png

The fields are not available, is there anyway to read the multi field values.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @Vinod-N-E ,
The problem is in your code you just missed composite="{Boolean}true" where you put the value as false.

composite="{Boolean}true"

This property will solve your problem.

Still, the recommendation is to use Coral 3 which is the latest.

New structure sample code,

 

<rootPaths
        jcr:primaryType="nt:unstructured"
        sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
        fieldLabel="Root nodes are not allowed"
        composite="{Boolean}true">
    <field
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/container"
            name="./rootPaths">
        <items jcr:primaryType="nt:unstructured">
            <parentPage
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
                    name="./tagsSearchRoot"
                    rootPath="/content"/>
        </items>
    </field>
</rootPaths>

 

 

 

View solution in original post

4 Replies

Avatar

Community Advisor

@Vinod-N-E Please see the example below for the multifield in AEM

https://exadel.com/news/setting-up-a-multifield-in-aem-touch-ui-dialogs-tutorial/

Please post the dialog xml here to get more support. When you say you are not able to read , you mean in Sling model or sightly ? Are you using composite multifield?

 

Avatar

Level 3
                                    <rootPaths
                                        jcr:primaryType="nt:unstructured"
                                        sling:resourceType="granite/ui/components/foundation/form/multifield"
                                        composite="{Boolean}false"
										fieldDescription="Root nodes are not allowed"
                                        name="./rootPaths">
                                        <field
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/foundation/form/fieldset"
                                            composite="{Boolean}false"
                                            key="rootPaths"
                                            name="./rootPaths">
                                            <items jcr:primaryType="nt:unstructured">
                                                <column
                                                    jcr:primaryType="nt:unstructured"
                                                    sling:resourceType="granite/ui/components/coral/foundation/container">
                                                    <items jcr:primaryType="nt:unstructured">
                                                        <parentPage
                                                            jcr:primaryType="nt:unstructured"
                                                            sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
                                                            name="./tagsSearchRoot"
                                                            rootPath="/content"/>
                                                    </items>
                                                </column>
                                            </items>
                                        </field>
                                    </rootPaths>

 

The values are getting posted to the crx, I am trying to validate the multi field using JS.

I am able to get the values before submit, but during the submit, the fields are not available that's the issue.

Avatar

Correct answer by
Community Advisor

Hello @Vinod-N-E ,
The problem is in your code you just missed composite="{Boolean}true" where you put the value as false.

composite="{Boolean}true"

This property will solve your problem.

Still, the recommendation is to use Coral 3 which is the latest.

New structure sample code,

 

<rootPaths
        jcr:primaryType="nt:unstructured"
        sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
        fieldLabel="Root nodes are not allowed"
        composite="{Boolean}true">
    <field
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/coral/foundation/container"
            name="./rootPaths">
        <items jcr:primaryType="nt:unstructured">
            <parentPage
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
                    name="./tagsSearchRoot"
                    rootPath="/content"/>
        </items>
    </field>
</rootPaths>