Motivation[edit | edit source]
You want to create a form that captures the specifications of an application that manages data saved from a form.
Method[edit | edit source]
Many times the resources needed to create an application are very similar. Many applications need basic operations such as:
- Create a New Record
- Read (view) a Record
- Update a Record
- Delete a Record
- Search for Records
These applications (sometimes referred to as a CRUD application for Create, Read, Update, Delete) are created over and over and frequently a pattern emerges. This pattern can be used as the basis for a specification and we can then build an XForms application to capture that specification.
This example assumes that the user wants to do these operations on a simple form and guides the user through a series of questions. A series of defaults is assumed but the user is allowed to override these defaults when the requirements differ from the standard.
The phrase "convention over configuration" is frequently used to describe a series of built-in assumptions about the default behavior of an application. If the developer of the application knows these conventions a highly functional initial application can quickly be created.
This form starts asking a series of questions, some of which are input fields, some check boxes and some text descriptions. Some input fields are referenced later in the application using binding rules. These binding rules are the conventional behavior of the application.
After the application specification is complete a "Generate Application" function can be executed. This will take the application specification file and execute a series of scripts on the server. Here are a sample of some actions that can be taken by these server-side build scripts. In this example we are using terminology from native XML data stores with XQuery REST interfaces but there are similar actions for RDBMS stores
- Create Default Collections
- data collection for XForms instance data
- edit collection for XForms editors (any forms that lock resources
- views collection for storing read-only views
- search collection for searching form instance data
- schemas collection for XML Schemas
- Create Application Template Files
- edit.xq - XForms editor for new records and updating records (generated form the XML Schema)
- new-instance.xml - default data for a new record
- search-fomn.xq - Generates an XForms application for searching
- search.xq - XQuery for searching records - return an HTML results page
- list-items.xq - A one-line summary of each XForms instance
- view-item.xq - A one-line summary of each XForms instance
As you can see the actions are the creation of server-side collections and files that are parameterized by the form instance.
Similarities to Ant Build Scripts[edit | edit source]
The application builder server-side script is similar to Apache build scripts in several ways. With Ant a series of folders and files are created when a build script is executed.
Screen Image[edit | edit source]