cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <...@apache.org>
Subject [CForms] Repeater with links
Date Mon, 27 Jun 2005 13:59:24 GMT
Here's a simple problem for which I cannot seem to find a simple 
solution (or any solution at all). I hope someone here can help me.

I have a Collection of Java beans. Each bean has a couple of 
properties: "id" (Integer) and "name" (String).

I also have a form with a repeater:

     <fd:repeater id="current">
       <fd:widgets>
         <fd:output name="id" id="id">
           <fd:datatype base="integer"/>
         </fd:output>
         <fd:output id="name">
           <fd:label>Name</fd:label>
           <fd:datatype base="string"/>
         </fd:output>
         <fd:booleanfield id="select">
           <fd:label>Select</fd:label>
         </fd:booleanfield>
       </fd:widgets>
     </fd:repeater>

The repeater is bound to the collection:

   <fb:repeater id="current" parent-path="." row-path="current">
     <fb:identity>
       <fb:value id="id" path="@id" direction="load"/>
     </fb:identity>
     <fb:on-bind>
       <fb:value id="name" path="name" direction="load"/>
     </fb:on-bind>
   </fb:repeater>

As you can see, data is mostly read-only. I am just interested in the 
value of the "select" field for selecting some rows to be further 
processed.

I also created a template for displaying the repeater as a two-column 
table. Column 1 is for the "select" widget, whereas column 2 shoud 
display the "name" property. That was easy.

The next requirement is for each "name" to be a link to an URL which 
depends on the value of the corresponding "id". Something like:

     <ft:repeater-widget id="current">
       <tr>
         <td><ft:widget id="select"/></td>
         <td>
           <a href="/base/[INSERT-ID-HERE]"><ft:widget id="name"/></a>
         </td>
       </tr>
     </ft:repeater-widget>

Now the question is: what would be the easiest way to put the "id" 
property of the bean bound to the current row in place of the 
"[INSERT-ID-HERE]" string?

	Thanks in Advance,

		Ugo

-- 
Ugo Cei
Tech Blog: http://agylen.com/
Open Source Zone: http://oszone.org/
Wine & Food Blog: http://www.divinocibo.it/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message