XForms Examples

This page provides a few XForms examples based on the XSLTForms and betterFORM XForms processors, which are both included in the eXist distribution. XSLTForms implements the XForms standard within the browser while betterFORM runs on the server. Have a look at the XForms documentation for more information.

However, eXist will also work with other XForms processors, like Orbeon or Chiba (the ancestor of betterFORM).

1. betterFORM Examples

Before executing the betterFORM examples they must be imported into the database via the Admin panel. Choose 'eXist-db-shipped-files' and execute 'Import Files' to do so.

The betterFORM Dashboard is a good entry point to browse through the betterFORM examples and to organise your own forms.

1.1. Reference & Demo Forms

FeatureExplorer

betterFORM live documentation. The FeatureExplorer itself is a XForms document that offers a navigation menu with links to many sample XForms that show working examples, the live CSS reference and respective links to the XForms 1.1 recommendation. The FeatureExplorer further demonstrates how to tailor one big XForm into multiple small ones which are loaded dynamically if requested by the user.

Registration

A simple registration form inspired by twitter demonstrating constraints and custom alerts

Contacts

Demonstrates usage of subforms including updating of the sub- and masterform.

Shopping Cart

A simple calculated shopping cart demonstrating the usage of (dependent) calculations, typing, XForms functions and XForms repeat actions.

1.2. XRX Sample App

Timetracker

A basic XRX application to demonstrate how to write your own single-page XRX applications with eXist and betterFORM.

2. XSLTForms Examples

2.1. Simple Examples

Hello world!

A very basic example.

Hello world 2

Another "hello world" which actually stores some data into the db and retrieves it later. Also demonstrates incremental instance loading.

Dynamic XForms

A simple XForms which is dynamically generated by an XQuery.

2.2. Advanced Example: Task Manager

The following example implements a simple, but functional task manager in XForms. It demonstrates features like switch/case and showing/hiding parts of a form, working with helper instances or communicating with an XQuery backend:

Wolfgang M. Meier