Multified Component -Default Item | Community
Skip to main content
Level 3
Mar 23, 2022 8:03 AM UTC
Solved

Multified Component -Default Item

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.
arunpatidar
arunpatidarAccepted solution
New Participant
Mar 23, 2022 12:24 PM UTC

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

Arun Patidar

10 replies

kautuk_sahni
Employee
Mar 23, 2022 8:52 AM UTC

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

Translate
Kautuk Sahni
Keerthi97Author
Level 3
Mar 23, 2022 9:49 AM UTC

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!

Translate
Siva_Sogalapalli
New Participant
Mar 23, 2022 10:23 AM UTC

@keerthi97  the example snippet shared by @kautuk_sahni should work, by default you would see it as shown in screenshot 1 and you need to click Add button to see default value(as you can see in Screenshot 2) and save the dialog at least once so that the default data will also get stored.

 

Screenshot 1: 

Screenshot 2: 

Hope this helps. 

 

 

Translate