cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: [cForms] Radiobuttons in repeaters
Date Fri, 13 May 2005 09:39:58 GMT
Reinhard Poetz wrote:

> This question has been asked on users@cocoon some time ago but IIRC 
> there was no  answer.
> I have the need for a repeater that has one boolean field at each row. 
> It should only be possible to select one row. Usually the logical 
> solution for this task is using radio buttons but this requires that 
> all fields have the *same* name which is not the case for fields 
> within repeaters.
> Has anyone found a solution (workaround) for this problem?

Add an integer field as a sibling of the repeater, and have place in 
each row a radio having that field's name and the row number as its value

  <fd:field id="selected-row">
    <fd:datatype base="integer"/>
  <fd:repeater id="items">

  <ft:repeater-widget id="items">
    <input type="radio" name="selected-row" value="${repeaterLoop.index}"/>

The "selected-row" widget then contains the selected row index, which 
you can use in event listeners and flowscript.

We could augment the repeater-action widget so that the "select" widget 
reference can not only be a boolean field in each row, but also a single 
integer field to handle such cases.


Sylvain Wallez                        Anyware Technologies  
Apache Software Foundation Member     Research & Technology Director

View raw message