Expand my Community achievements bar.

SOLVED

Get data from multi-composite field in component jsp

Avatar

Level 1

   Hi all,

I have a component I'm trying to build that's basically a simple navigation list of links. 

My dialog is using a mtmulticomposite field like so:

<multi jcr:primaryType="cq:Widget" name="./links" prefix="./" xtype="mtmulticompositefield"> <fieldConfigs jcr:primaryType="cq:WidgetCollection"> <linkText jcr:primaryType="cq:Widget" fieldLabel="Link Text" name="linkText" xtype="textfield" width=""/> <linkURL jcr:primaryType="cq:Widget" fieldLabel="Link URL" name="linkURL" xtype="textfield" width="100"/> 

 

This code is working fine and the dialog is behaving as expected, but I don't know how to include this data inside my component .jsp file?

Normally for xtype="textfield" I just use <cq:text name="field_name"> but in this case I'm not sure what to do.

Basically I would use those fields to populate a list of links like so:

<ul> <% iterate through my multi-composite data somehow... %> <li href="mutli-composite-link">mutli-composite-text</li> <%end iteration %> </ul>

 

Any help on how to do this is appreciated!

1 Accepted Solution

Avatar

Correct answer by
Level 7

1st you can get the currentNode and call getNodes method on currentNode then iterate them to get your fields values.

http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html?is-external=true

View solution in original post

2 Replies

Avatar

Level 10

In this article of a custom xtype - there is examples of how to get data from a dialog into a component JSP - (different widgets however):

http://helpx.adobe.com/experience-manager/using/creating-custom-xtype.html

Avatar

Correct answer by
Level 7

1st you can get the currentNode and call getNodes method on currentNode then iterate them to get your fields values.

http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html?is-external=true