Thursday 24 December 2020

Multifield with 2 child multifileds in touch UI

 








Below is the dialog code:

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/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="Secondary Content"

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

    helpPath="en/cq/current/wcm/default_components.html#Image">

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

            margin="{Boolean}false"/>

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

            <tab1

                jcr:primaryType="nt:unstructured"

                jcr:title="General"

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

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

                    <layoutType

                        jcr:primaryType="nt:unstructured"

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

                        fieldDescription="Layout Type"

                        fieldLabel="Layout"

                        name="./colType">

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

                            <layout1

                                jcr:primaryType="nt:unstructured"

                                text="2-Column"

                                value="2"/>

                            <layout2

                                jcr:primaryType="nt:unstructured"

                                text="3-Column"

                                value="3"/>

                        </items>

                    </layoutType>

                </items>

            </tab1>

            <tab2

                jcr:primaryType="nt:unstructured"

                jcr:title="Secondary Content"

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

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

                    <fieldset

                        jcr:primaryType="nt:unstructured"

                        jcr:title="Secondary Content Elements"

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

                        <layout

                            jcr:primaryType="nt:unstructured"

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

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

                            <column

                                jcr:primaryType="nt:unstructured"

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

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

                                    <secContent

                                        jcr:primaryType="nt:unstructured"

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

                                        class="full-width"

                                        composite="{Boolean}true"

                                        fieldDescription="Click 'Add Field' to add a new secondary content"

                                        fieldLabel="">

                                        <field

                                            jcr:primaryType="nt:unstructured"

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

                                            acs-commons-nested=""

                                            name="./secondaryContent">

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

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

                                                        <icons

                                                            jcr:primaryType="nt:unstructured"

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

                                                            fieldDescription="Select Primary Icon"

                                                            fieldLabel="Icon"

                                                            name="./icon">

                                                            <datasource

                                                                jcr:primaryType="nt:unstructured"

                                                                sling:resourceType="acs-commons/components/utilities/genericlist/datasource"

                                                                path="/etc/acs-commons/lists/bbva-icons"/>

                                                        </icons>

                                                        <secondarymultifiled

                                                            jcr:primaryType="nt:unstructured"

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

                                                            class="full-width"

                                                            composite="{Boolean}true"

                                                            fieldDescription="Click 'Add Field' to add a new secondary content"

                                                            fieldLabel="">

                                                            <field

                                                                jcr:primaryType="nt:unstructured"

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

                                                                acs-commons-nested=""

                                                                name="./secondaryContent1">

                                                                <layout

                                                                    jcr:primaryType="nt:unstructured"

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

                                                                    method="absolute"/>

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

                                                                    <comboPlayer

                                                                        granite:class="videoplayerid video"

                                                                        jcr:primaryType="nt:unstructured"

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

                                                                        fieldDescription="Provide a valid video ID as displayed in the Brightcove account. "

                                                                        fieldLabel="Youtube ID's"

                                                                        name="./videoPlayer1"

                                                                        required="true"/>

                                                                </items>

                                                            </field>

                                                        </secondarymultifiled>

                                                        <secondarymultifiled2

                                                            jcr:primaryType="nt:unstructured"

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

                                                            class="full-width"

                                                            composite="{Boolean}true"

                                                            fieldDescription="Click 'Add Field' to add a new secondary content"

                                                            fieldLabel="">

                                                            <field

                                                                jcr:primaryType="nt:unstructured"

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

                                                                acs-commons-nested=""

                                                                name="./secondaryContent2">

                                                                <layout

                                                                    jcr:primaryType="nt:unstructured"

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

                                                                    method="absolute"/>

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

                                                                    <comboPlayer

                                                                        granite:class="videoplayerid video"

                                                                        jcr:primaryType="nt:unstructured"

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

                                                                        fieldDescription="Provide a valid video ID as displayed in the Brightcove account. "

                                                                        fieldLabel="DAM Video ID's"

                                                                        name="./videoPlayer2"

                                                                        required="true"/>

                                                                </items>

                                                            </field>

                                                        </secondarymultifiled2>

                                                    </items>

                                                </column>

                                            </items>

                                        </field>

                                    </secContent>

                                </items>

                            </column>

                        </items>

                    </fieldset>

                </items>

            </tab2>

        </items>

    </content>

</jcr:root>


3 comments:

  1. When I tried your approach, I am unable to save the values. Dialog is not closing. Any idea how to fix this issue.

    ReplyDelete
    Replies
    1. I am able to saved it in my local. So seems some other JS is breaking in you instance.
      Can you please inspect that page and check if while saving any console JS error is coming.

      Delete

  2. Getting Below Eroor:
    foundation.012d130508e7ffc1e4357b0593a7489a.js:8838 Uncaught TypeError: fieldAPI.getName is not a function
    at foundation.012d130508e7ffc1e4357b0593a7489a.js:8838
    at Array.forEach ()
    at HTMLElement. (foundation.012d130508e7ffc1e4357b0593a7489a.js:8831)
    at Function.each (jquery.fb50358df4c2bd6aa6e1dd5b0d9b9d29.js:370)
    at jQuery.fn.init.each (jquery.fb50358df4c2bd6aa6e1dd5b0d9b9d29.js:137)
    at HTMLElement. (foundation.012d130508e7ffc1e4357b0593a7489a.js:8830)
    at Function.each (jquery.fb50358df4c2bd6aa6e1dd5b0d9b9d29.js:370)
    at jQuery.fn.init.each (jquery.fb50358df4c2bd6aa6e1dd5b0d9b9d29.js:137)
    at HTMLFormElement.handler (foundation.012d130508e7ffc1e4357b0593a7489a.js:8824)
    at foundation.012d130508e7ffc1e4357b0593a7489a.js:5041

    ReplyDelete