Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Flow Process

This article explains the order the various elements of Flow are called.

Process


1. Entry Pipeline calls JS function
2. (optional) JS function loads data
3. JS function calls DisplayForm pipeline
4. DisplayForm Pipeline sends page to visitor
5. Visitor submits page
6. Continuation Pipeline returns to JS
7. JS validation, loop to #3 if necessary
8. JS saves data
9. JS calls Exit Pipeline
10. Exit Pipeline sends confirmation to visitor

XMAP


Resource for finishing forms:
<map:resource name="form-finish">
<map:transform type="forms"/>
<map:transform src="formfixer.xsl">
<map:parameter name="language" value="{page-envelope:document-language}"/>
</map:transform>
<map:transform src="../../resources/forms/forms-samples-styling.xsl"/>
<map:transform type="i18n">
<map:parameter name="locale" value="{page-envelope:document-language}"/>
</map:transform>
<map:serialize type="xml" />
</map:resource>

- FormFixer is available here.
- forms-samples-styling.xsl is from Cocoon's Forms Block. Copy the file to the directory specified.
Where is JavaScript code:
<map:flow language="javascript">
<map:script src="code.js"/>
</map:flow>

Continuation Pipeline
<map:match pattern="**/*_*.more">
<map:call continuation="{2}"/>
</map:match>

Entry pipeline:
<map:call function="myFunction"/>
DisplayForm pipeline:
<map:match pattern="displayform">
<map:generate src="template.xml"/>
<map:call resource="form-finish"/>

Exit pipeline
<map:match pattern="success">
<map:generate type="jx" src="success.xml"/>
<map:call resource="form-finish"/>

JavaScript "code.js"


cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");

function myFunction(){
var form = new Form("form.xml");
var model = form.getModel();
//load data
model.myField = "data";
var done = false;
do{
form.showForm("displayform");
model = form.getModel();
myField = "";
if(model.myfield != null){
myField = new Packages.java.lang.String(model.myfield);
}
done = true;
if(myfield.length == 0) done = false;
}while (!done);
// save data
cocoon.sendPage("success", {"myfield":myfield});


<< SetupLanguage >>

Contact Solprovider
Paul Ercolino