Get data from multi-composite field in component jsp | Community
Skip to main content
October 16, 2015
Solved

Get data from multi-composite field in component jsp

  • October 16, 2015
  • 2 replies
  • 1461 views

   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!

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 Dinu_Arya

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

2 replies

smacdonald2008
Level 10
October 16, 2015

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

Dinu_Arya
Dinu_AryaAccepted solution
Level 6
October 16, 2015

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