cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
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

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

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

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

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message