Apache » Cocoon »

  Cocoon Forms
      1.0
   homepage

Cocoon Forms 1.0

RepeaterAction widget

Concept

This is a specific type of action widget that handles the much needed case of adding or removing rows from a repeater.

Definition

<fd:repeater-action id="..." command="delete-rows|add-row" number-of-rows="..." repeater="..." select="..." state="...">
  <fd:label>...</fd:label>
  <fd:help>...</fd:help>
  <fd:hint>...</fd:hint>
  <fd:on-action>
    [...]
  </fd:on-action>
  <fd:on-create>
    [...]
  </fd:on-create>
  <fd:attributes>
    <fd:attribute name="..." value="..."/>
  </fd:attributes>
</fd:repeater-action>

The command attribute (previously called action-command) should have either the value delete-rows or add-row. If add-row is specified, the attribute repeater is required, and the number-of-rows attribute can be optionally set to the number of rows to add at once. If delete-rows is specified, both the repeater and select attributes are required.

The repeater attribute should contain the id of the repeater widget on which this repeater-action should act. This must be a sibling of the repeater-action widget (see also row-action for actions inside a row).

The select attribute should contain the id of the booleanfield widget (or any type of widget who's getValue() method returns a boolean) that is part of the repeater and used to mark the rows to be deleted.

fd:on-action allows additional event handlers to be defined, see also Event Handling. The interface to be implemented for Java event listeners is org.apache.cocoon.forms.event.ActionListener. The WidgetEvent subclass is org.apache.cocoon.forms.event.ActionEvent. The event handlers are called after the action is performed except for the delete-rows action where event handlers are called before the selected rows are deleted.

Template & styling

See the action widget.

Errors and Improvements? If you see any errors or potential improvements in this document please help us: View, Edit or comment on the latest development version (registration required).