RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Create Mobile Applications with IBM Forms for Mobile Devices : Page 2

The power of Web forms has brought no-code solutions to data management applications. Find out how a new preview technology from IBM alphaWorks helps you extend data management apps into the mobile arena.

Creating Forms
Once you configure the IBM Forms for Mobile Devices per the instructions that accompany the release, it's time to develop some forms. To do this, you must first create a project to contain the form instance, and then create one or more forms. In the process of creating the instance, you specify the back-end database to which your data will be saved (at present, only DB2 databases are supported, although you can create your own interfaces to legacy applications, called connectors, which is covered more throroughly later). This instance encapsulates the metadata about the database in XML, including access information as well as the schema (called a table space in DB2 lingo), and provides the data model for the forms application.

The IBM Forms Template Wizard creates individual forms based on the instance. The wizard gives you two choices: use the information in the instance document you created to create the forms template, or create forms templates based on a hand-crafted XForms instance document. XForms is a robust XML application for describing electronic-based forms being set out by the W3C, it's instructive to look at a simple example such as the one provided with the release, because it points to the capabilities and limitations of both IBM Forms for Mobile Devices and XForms as a whole. Listing 1 contains ExpenseAccount.xml, an XForms document that describes a simple expense account.

A cursory examination of Listing 1 shows that an XForms document is divided into two sections: the model, contained in the heading of the document and the view, contained within the body of the document itself. The model is aptly placed within the <xforms:model> block, and contains a list of the variables that pertain to the form as described by <xforms:bind> directives. These directives name each form variable as well as place constraints on its type, such as a signed or unsigned integer or character string. The view is contained within the <body> block and consists of one or more <xforms:output> and <xforms:model> block. The <xforms:input> blocks can in fact provide not just the prompt for a form's field, but the contents of an alert that should appear when the entry is incorrect, as you can see from the use of the <xforms:alert> tags scattered throughout the document.

Most of the time, you can be content working directly with the instance document you created, configuring the characteristics of each element using the Set Elements Properties of the template wizard. Using this facet of the wizard, you can indicate which fields of the database table should be on the form.

Once you create the forms template, you must export it to the server as a Mobile Forms Archive. This article's download contains the instance data and form template files. It's created by the Export Wizard and placed on the file system or the remote WebSphere server for you when you provide the server's IP address and port number.

Managing Forms on the Handheld
On the handheld device, the IBM Forms for Mobile Devices application provides an in box/out box metaphor. To begin, synchronize the application with the server, which transfers the forms you created into your handheld application in box. These are empty form templates, stationery from which you can draw one or many instances of the same form to provide additional data. As you complete instances of forms, they go into your out box, where they'll be sent to the server the next time you synchronize(think of each form as a record in your database's table).

The client application maintains a cache of empty and completed forms, letting you collect data unfettered from the network for as long as you wish. While forms are in your outbox, you can continue to work with them, so it's possible to edit changes to a form you've started and already marked as complete. This makes it easy to correct errors on the handheld without server-side intervention.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date