IBM developerWorks XForms Tips
This page lists some of the XForms tips avaialble from a search at IBM developerWorks. It should be replaced with a link to an XForms Tips page there, but there is not one.
XForms is about collecting data, but it is also about improving the user experience. In some cases, you need to provide additional information to the user outside of the actual form. In traditional Web pages, you accomplish this through the use of alert boxes and pop-up windows. In addition to its help capabilities, XForms gives you a number of different options for providing additional information for the user. This tip explains alerts and message boxes, the difference between them, and how to use them.
Saving data to local files and reusing later with XForms
Partially completing an online form, only having to leave before you've finished, can be frustrating. XForms can fix this problem. There's a quick and easy way to save the instance data of an XForm so that you can reuse it later.
Sending XForms data using e-mail
Part of the value of forms is their ability to send information where you need it. In the case of Web forms, that destination is normally a Web server that analyzes the right data. But what if you want to send the information using e-mail? In XForms, you have two options for accomplishing this feat; one on the server side, and one on the client side. This tip shows you how to e-mail XForms data from PHP, and also directly from the browser.
The Perl programming language is widely used on the Internet, and it will continue to be popular for quite some time. It's considered an easy language to program in because it handles strings very well. Also, what you can do in a few lines in Perl takes many more lines of code in other programming languages. In this tip, you'll learn how to submit an XForms form using POST to a Perl script, and capture the data for later use.
Much has been made about the ability of XForms to provide interactivity, and to submit information in XML. But none of that will do you any good unless you have a way to analyze the data once you send it to the server. This tip shows you how to access the submitted XML data using a Java servlet.
In some ways, an XForms form is just like an HTML form; with the proper encoding, the server-side script receiving the data won't even know the difference. But the strength of XForms forms is in many ways the fact that the data can be submitted directly as XML. Of course, this capability doesn't do you any good unless the script is prepared to receive the data. In this tip, you will see how to create a PHP script that can receive and work with XML data submitted by an XForms form.
Dealing with dates and time with XForms
Forms often use a date to log the day that a transaction occurred. The time is also useful since it can be used to log when a job was completed, or when something was purchased. This tip shows you how to use the date and time schema types using XForms.
Using the switch/case elements
XForms are designed to provide an interactive experience, and in many cases that means showing the user different information based on different conditions. For example, you may have a form with multiple sections, but you don't want to overwhelm the user by displaying it all at once. In this tip, you will use XForms switch and case elements to display only part of a form at any given time.
Asynchronous JavaScript and XML, or Ajax, has been causing a stir in the Web world for some time now, because it enables Web designers to create an application that reacts to the user's actions without having to reload the entire page, a capability that already exists natively in XForms. This tip looks at both the XForms and Ajax versions and how to combine the two techniques. There are plenty of resources out there to teach you how to actually make Ajax requests, but XForms provides some special challenges and opportunities in using the data once you get it back.