Apache » Cocoon »

  Cocoon Forms
      1.0
   homepage

Cocoon Forms 1.0

RowAction widget

Concept

This is a specific type of action widget that handles frequent actions occuring on a repeater row, such as adding/removing a row and moving it up and down. These widgets should be placed inside a repeater and act on the current row.

Definition

<fd:row-action id="..." command="add-after|delete|move-up|move-down" 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:row-action>

The command attribute (previously called action-command) should have either the value add-after, delete, move-up or move-down.

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 row action where event handlers are called before the row is deleted.

Where all you want to do is submit a specific row on a repeater, simply add a fd:submit element to the widgets for the repeater.

Then, you can access the submitted row either using an event handler with event.getSourceWidget().getParent(), or from the flow using form.getWidget().getSubmitWidget().getParent(). The row itself has a lookupWidget(widgetName) method that can be used to access specific widgets for the row.

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).