CForms Block Samples

Back

Back - to Cocoon Samples main page
Back - to Cocoon Blocks Samples main page
Cocoon Forms Documentation - Documentation is available on the Cocoon site.

Samples with the (Ajax) mark use the new transparent Ajax (Asynchronous Javascript And XML) framework to reduce client/server roundtrips and perform partial page updates.

Basic Samples

Various (Actions) - This sample shows validation, event handling and various Cocoon Forms features.
Various (Flowscript) - The same sample as above using Flowscript.
Registration - A simple registration form.
Car selector - (Ajax) Illustrates programmatically changing selectionlists.
Country selector - Illustrates programmatically changing flow-jxpath selectionlists.
Upload - Shows an upload widget used with Flowscript
Form Model GUI - Illustrates the use of Class, New, Struct, and Union.
HTMLArea - A simple form using the HTML editor widget (deprecated, use alternatives instead).
Aggregate - Aggregate field examples
Multipage wizard - (Ajax) A multipage wizard, using widget states and actions to move between pages.
CAPTCHA validation - CAPTCHA validation (requires Batik block)
ImageMap - A simple form using the Image Map widget
Calculated fields - Calculated fields : values are calculated automatically

Binding Samples

Cocoon Forms has a binding framework which assists in copying Java-bean or XML (DOM) data into a form and back.

XML Binding - A form for just editing an XML file.
Simple XML Binding - A form for just editing XML data. Illustrates the XMLAdapter.
Bean Binding - A form for just editing a Java bean

Step-by-step tutorial into individual binding features:

1. Binding Simple Values - fb:*/@direction and fb:value/*
2. Lenient Binding - fb:*/@lenient
3. Aggregate Binding - fb:aggregate
4. Heavy Form - Form with lots of select boxes - test memory utilization, performance
5. Custom Bindings using Java or Javascript - fb:javascript and fb:custom
6. XML binding using namespaces - Using XML binding with complex namespaced XML

Database access

Easy SQL database access - SQL database query and update without any custom Java code, O/R mapping tool nor form binding. Uses flowscript, Map and List views on the forms and the database (using JDBI).

Locales

The samples below are the same as the basic flowscript sample but now use different locales. The locale can affect things like date and number formatting. You can try out other locales by supplying other values for the locale parameter in the URL.

Flowscript - France
Flowscript - Italy
Flowscript - Germany
Flowscript - Belgium (dutch)
Flowscript - Greek
Flowscript - Chinese

Dynamic templates and recursive forms

These samples were written for the GT2004 presentation about dynamic templates and recursive forms. They illustrate the use of "jx-macros.xml" to interpret form template elements within the generator, allowing the page layout to depend on the contents of the form, and the use of fd:union and fd:class widgets.

Dynamic repeater template - (Ajax) Shows a simple repeater, which isn't displayed at all if empty, and whose row action depend on the row number.
Datasource chooser - (Ajax) A datasource chooser, illustrating the fd:union widget.
Task tree - (Ajax) A project work breakdown into a hierarchy of tasks, showing the use of the fd:class and fd:new widgets.

Tree widget samples

File explorer - (Ajax) A file explorer built with two tree widgets.
Sample tree - (Ajax) Scratchpad for random samples of the Tree widgets.

Advanced Ajax samples using Dojo widgets

Drag and drop reordering, in-place editing - (Ajax) The dynamic repeater sample revisited, featuring drag and drop reordering of rows, selecting rows by clicking anywhere in the row, and in-place editing of values.
Multi drag and drop reordering - (Ajax) The dynamic repeater sample revisited again, this time featuring drag and drop reordering of rows, with the ability to drag and drop from one repeater to another.
Cocoon suggests - (Ajax) Very simple demo of the <fd:suggestion-list> feature.
Cocoon multivalue editor with suggestions - (Ajax) Very simple demo of the <fd:multivaluefield> with suggestion support feature.
Cocoon double-list multivalue widget - (Ajax) Demo of the double list <fd:multivaluefield>.
In place editing - (Ajax) Various ways to use in place editing.
Upload Progress - Shows upload widgets in a repeater with a progress bar
Other Ajax samples - (Ajax) Don't forget to look at the samples in the Ajax block!

Dynamic repeater template and event handling

Dynamic repeater template - Create your Euro 2004 soccer dream team

Profiling information

These samples concentrate on Cocoon Forms and JXTemplate in order to collect profiling information. In order to keep the samples as lean as possible, an action is used as controller.

form1 - JXTemplate - Render form using JXTemplate macros
form1 - FormsTransformer - Render form using the FormsTransformer

Forms Library samples

This demonstrates the new library subsystem of Cocoon Forms. This is currently under development and is likely to change.

Basic Sample - Basic Sample
Basic Sample 2 - Basic Sample 2 (depends on the same library as above, see how it still changes after editing the library and reloading the first)
Hotel Booking Sample - Hotel Booking Sample, elaborate use of libraries.

Repeater advanced features

This demonstrates the Google Summer of Code 2006 improvements to the repeater.

Pagination, sorting and filtering - Pagination, sorting and filtering.