Home > Articles > Web Services > XML

  • Print
  • + Share This
From the author of

The InfoPath Interface

The InfoPath interface is similar to other applications in the Office System 2003 suite (see Figure 1). The general look-and-feel is similar, including menu and button bars. InfoPath's task pane is pivotal in the design of form templates, displaying content to support specific tasks during the form design and form filling processes. There are two modes: form filling mode and design mode. Forms can be designed to prevent users who fill out forms which use the same InfoPath client as that for designing the form template from changing the form template's design.

Figure 1Figure 1 The InfoPath user interface.

Under the Covers

The following list gives an indication of the multiple XML technologies used in InfoPath; some are used in all InfoPath forms, some only in selected situations.

  • XML 1.0

  • Namespaces in XML 1.0

  • XSLT 1.0

  • XPath 1.0

  • W3C XML Schema 1.0 (Structures and Datatypes)

  • DOM Level 1

  • XML Digital Signatures

  • SOAP 1.1

  • WSDL 1.1

If you're familiar with programming other Microsoft Office applications, you might expect InfoPath to use Visual Basic for Applications (VBA) or the .NET framework (as is to be used in the upcoming Visual Studio Tools for Office). In InfoPath 2003, at least, neither is used programming of the InfoPath object model is achieved using either JScript or VBScript.

NOTE

Scripts in a form template must be exclusively JScript or VBScript. The languages cannot be mixed.

The InfoPath Form Template

An InfoPath form template is a cabinet file (.cab), but in InfoPath the cabinet file has an .xsn extension. Inside the .xsn file are all the files used by InfoPath when creating or modifying the form's characteristics and behavior, as shown in Table 1.

Table 1 InfoPath File Extensions

Extension

Description

.xsn

Form template containing all the other InfoPath files.

.xsf

InfoPath manifest file an XML file that defines many characteristics of a form, including the names of the files used.

.xsl

XSLT files used in InfoPath to create different views in a form.

.xsd

One or more W3C XML Schema files used to constrain the structure of the XML underlying the form.

.xml

An XML file containing default data for display in a new form.

.js or .vbs

JScript or VBScript files that define business logic in the form.

.jpg etc.

Images, such as logos, used in a form.

.dll and/or .exe

Custom COM components.


The InfoPath interface and wizards allow many tasks to be carried out without directly editing files inside the file template, but more complex tasks require hand coding of selected files. InfoPath can automatically unpack the .xsn file to allow hand editing of those files, and then repackage them.

Form and Validation Events

The events used in InfoPath are proprietary to Microsoft and have little resemblance to the XML Events specification from the W3C. InfoPath events can be divided into form events and validation events, as shown in Tables 2 and 3.

Table 2 Form Events

Event

Description

OnAfterImport

Allows scripting in response to forms being merged.

OnClick

Occurs when a button is clicked.

OnLoad

Used to initialize a form. The OnLoad event fires before the initial view is displayed.

OnSubmitRequest

Occurs when a form is submitted.

OnSwitchView

Occurs when the initial view is opened or when a view is switched.

OnVersionUpgrade

Responds to mismatches between the version number of the form and the version number of the corresponding form template.


Table 3

Data Validation Events

Event

Description

OnBeforeChange

Occurs after a change has been made to the DOM underlying the form's XML, but before the change is accepted.

OnValidate

Occurs after a change has been accepted.

OnAfterChange

Occurs after the OnValidate event.


If you're familiar with HTML forms, you may notice that there are no events in InfoPath corresponding to, for example, the form control acquiring or losing focus. Creating event handlers for the listed functions in JScript or VBScript is pivotal to creating custom InfoPath forms.

  • + Share This
  • 🔖 Save To Your Account