For now, just some pointers to get you started:

General flowscript info:

Woody API:

Woody API v2:

Some techniques

A button to end the form and show something else

(based on a hint by Sylvain Wallez on cocoon-dev)

Suppose you want to have e.g. a cancel button on a form, so that when pressed, the form.showForm() function returns and you can show another page.

Use something like this in the form defintion:

<wd:submit id="cancel" validate="false" action-command="myAction">
   ...
</wd:submit>

Note that we use a submit widget, and not an action widget, since an action widget will always redisplay the form.

Then in the flowscript you can check which button was pressed as follows:

form.showForm("form.html");
if (form.submitId == "cancel") {
    cocoon.sendPage("cancel.html");
}

A button in each row of a repeater-widget to show details of that row

When you add the submit widget in a repeater row, you can check the value of the row ID and use that for further processing.

In the flow go up one level to the Parent node and then decend to the rowID node. Request the value of that node.

In the sample below the rowID is printed to the console. You can put it in the request, session, global variable, ... for further processing.

Put something like this in the form definition doc. The action-command attribute is not used here, but has to be entered.

<wd:submit id="showRow" action-command="showRowAction">
  <wd:label>Edit Row</wd:label>
</wd:submit>

The form template simply gets a widget in the repeater-widget

<wt:widget id="showRow"/>

In the Flow you can request the value of the rowID and use that value for further processing. Here it's added to the URL as a request parameter.

if (form.submitId == "showRow") {
  var thisRow = form.getWidget().getSubmitWidget().getParent();
  print("rowID = " +thisRow.getWidget("rowID").getValue());
  cocoon.sendPage("rowPage?rowID=" + rowID);
} else {
  cocoon.sendPage("resultPage");
}

WoodyFlowscriptAPI (last edited 2009-09-20 23:40:11 by localhost)