< Day Day Up > |
Changes in business circumstances over time mean that a need to make one or more changes to InfoPath form templates, other than prototypes , is almost inevitable. The reason for devoting a chapter to updating and modifying InfoPath 2003 form templates is that doing so is often far from easy. The major problems occur when the data source of the form template is modified. InfoPath 2003 has no facility to easily and automatically modify a form template's data source. That lack of automatic form template modification means that we will need to delve into the structure of several of the files that make up an InfoPath form template. First, let's look at why updating and modifying an InfoPath form template is much more of a consideration for the InfoPath developer than, for example, modifying a classic HTML/XHTML form.
The Implications of Offline Form CompletionThe ability to allow the completion of forms offline in InfoPath 2003 raises issues that don't occur with traditional HTML forms. A primary difference is the time period over which downloaded forms can be filled in and returned. For traditional HTML/XHTML forms, the time period is likely to be seconds or minutes. For InfoPath forms, the time period may be minutes, hours, or days, and occasionally may even be measured in weeks. Consider the scenario with a traditional HTML form. A user uses a Web browser to access the URL at which the HTML form is located. The form is downloaded to the user 's machine and is typically filled in after a few minutes or less. If there is a need to change the server-side business processes, the URL from which the form is downloaded can be made briefly unavailable. Any forms already downloaded to a user's machine are likely to be filled in and submitted over the next several minutes. The form at the original Web page can be replaced by a redirection page so that any new users of the (replacement) form are automatically redirected to the new form. They will, transparently , download that amended form, fill it in, and submit it to the (new) server-side process appropriate to that revised form. The authoring of the revised HTML form and the revised server-side process can all be done before making the new form publicly available. As far as users are concerned , they fill in the form presented to them and submit it successfully. Apart from the possibility of the form being unavailable (probably for only a few seconds), the user experience works well around the transition. The timescale that applies to InfoPath forms makes the approach used for HTML forms problematic . In addition, the widespread use of W3C XML Schema in the background while processing InfoPath 2003 forms raises further issues. For HTML/XHTML forms, the server-side process is likely to be custom-coded in a scripting language. The amended file submits to a different URL, which references the appropriate custom scripting code. For an InfoPath form template, the situation is different. The structure of the (old) form is defined by a W3C XML Schema document. If the form template is modified, it is likely that when the form data is submitted, the server-side W3C XML Schema document won't match, and an error will occur.
Let's look at the files that might need to be hand-edited and consider what purpose each of these files serves in the overall functioning of InfoPath and the form template. Contents of an InfoPath Form TemplateTo understand what you might need to change, let's take a brief look under the hood at how InfoPath 2003 works. An InfoPath form template typically consists of an .xsn file ”the form template that's a cabinet file containing several other files. So, if you wish, you can rename the .xsn file with a .cab suffix, and open the cabinet file with any tool that understands cabinet files. An InfoPath form template, when unpacked, contains the following file types:
For more information about unpacking a form template, see "Unpacking a Form Template," p. 260 . Each of these files is discussed in more detail in Chapter 15. For InfoPath to work correctly, it is essential that the XML created from the information the user enters in the form matches the XML specified or used in the various form template files. If any discrepancy occurs, an error will take place at some point in processing a form, including the possibilities that a form won't open successfully or won't submit. Many possible scenarios involve changes to the data source and therefore require the editing of individual form template files. We'll discuss the types of changes necessary in relevant files later in this chapter. Visual ChangesWhen changes are made only to the visual presentation of a form template without any change to the data source, the situation is relatively straightforward. The data source remains unchanged, so there is no need to edit individual files to reflect any change in the structure of the data source, as no such change exists unless you hand-coded style elements using the CSS !important directive. You can make the visual changes you want using the InfoPath user interface. |
< Day Day Up > |