Multified Component -Default Item | Community
Skip to main content
Level 3
March 23, 2022
Solved

Multified Component -Default Item

  • March 23, 2022
  • 1 reply
  • 2718 views

Hi ,

I am working on Multified Component and would like to know how to set one item as default in the dialog box .So,Author will be able to add multiple field values on selecting the 'Add' option .Please help me with this .

 

Thanks.

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

Hi @arunpatidar ,

 Default value is getting reflected but i want to see one field items as default on configuring the dialog and so i can add multiple items by clicking on the 'Add' option.

 

Thanks.


Hi,

This can be achieved by adding a default node structure in component's cq:template node.

http://prashantonkar.blogspot.com/2019/01/composite-components-in-aem-using.html

1 reply

kautuk_sahni
Community Manager
Community Manager
March 23, 2022

Hi @keerthi97 

Adding the property "value" to your dialogue input fields would be your solution. 
Take a look at the example below:

 

 

<navigationLinks
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
   fieldLabel="Navigation Links">
   <field
      jcr:primaryType="nt:unstructured"
      sling:resourceType="granite/ui/components/coral/foundation/container"
      name="./navLinks">
      <items jcr:primaryType="nt:unstructured">
         <fieldset
            jcr:primaryType="nt:unstructured"
            jcr:title="Link"
            sling:resourceType="granite/ui/components/coral/foundation/form/fieldset">
            <items jcr:primaryType="nt:unstructured">
               <linkLabel
                  jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
                  fieldLabel="Link Label"
                  name="./linkLabel"
                  value="@@@@@@@INiTIAL VALUE GOES HERE@@@@@@@@"/>
            </items>
         </fieldset>
      </items>
   </field>
</navigationLinks>

 

HTH

Kautuk Sahni
Keerthi97Author
Level 3
March 23, 2022

Hi @kautuk_sahni ,

Thanks for your response!

 

I tried adding the value property in the input field ,but still it doesn't work.Could you please provide some examples for setting the value property .

 

Thanks in Advance!

arunpatidar
Community Advisor
Community Advisor
March 24, 2022

Hi @arunpatidar ,

Thanks for your response.

Is there any OOTB component to show one default container on the dialog in the multifield component and able to add multiple values using add option.Please suggest.

 

 

Thanks.


If you are using composite type multifield

 

then your cq:template node should look like below

<?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">
    <items
        jcr:primaryType="nt:unstructured">
        <item0
            jcr:primaryType="nt:unstructured"
            question="val1"/>
    </items>
</jcr:root>

 

Arun Patidar