|
7.1. Are InfoPath Forms Better?Creating data entry forms is perhaps the number one programming task today. Years ago, Visual Studio made this task easier with controls and drag-and-drop design tools; however Windows and Web form design is still much too hard for non-programmers. Note: Do we need another forms engine? Face it, InfoPath is just another way to display data entry forms, similar to web forms in ASP.NET and Windows forms in err... Windows. The main difference is that InfoPath forms are XMLbased, which means you can easily create those forms from XML data sources. InfoPath provides form design tools that can be used by intermediate to advanced Office System users. It simplifies design, distribution, validation, and data collection tasks; plus, InfoPath provides templates for the most common types of forms. This simplification is possible because InfoPath is based on a several assumptions:
Because these assumptions are built in to the design of the product, InfoPath makes performing those tasks much easier. Specifically, tasks that were formerly done by programming can now be done by setting control properties or adding predefined actions and rules to controls. This approach is called declarative programming and it contrasts with the imperative approach most programmers are used to. Finally, InfoPath forms are based on XML. You can create them from existing XML or XSD files or any XML data source, such as a web service or Access/SQL database. Why is this important? Because it provides a standards-based way to integrate data collected by InfoPath into other systems in an enterprise. Note: For certain types of applications, InfoPath forms can save you a great deal of work. They aren't a silver bullet, though, and you need to judge when their use is appropriate. 7.1.1. Where to get itInfoPath is included with the Microsoft Office System Professional Enterprise Edition. That edition is available through volume licensing only. However, you can try InfoPath for 60-days through the InfoPath 2003 Evaluation Kit or buy it as a standalone product outside of the Office System. 7.1.2. What about...
The Version 1.0 release of InfoPath is an interesting first attempt, but the SP1 release provides many more capabilities including additional controls, actions, programmability, links to SharePoint lists, and much more. If at all possible, you should work with the SP1 releasethis chapter uses that release throughout, though I do note where key features aren't available in Version 1.0. Note: The SP1 preview expired July 31, 2004, and is now part of Office 2003 Service Pack 1. 7.1.3. How to do itInfoPath is both a form designer and a form viewer, so InfoPath tasks can be divided between Designers and Users as shown in Figure 7-2. Figure 7-2. InfoPath both designs and views formsTo design a form: Note: Why doesn't InfoPath have a separate, distributable runtime? I don't know. For now, Microsoft licenses the design and runtime environments together and there's no way to separate the two, though you can disable the design mode (see "Prevent Design Changes").
You can modify the form by selecting any of the options in the Task pane. To preview the results of changes:
Once you are satisfied with a form, you have a choice: you can save the form for local use or testing, or you can publish the form for others to use. To publish a completed form: Figure 7-3. Modify an existing sample to get a quick startFigure 7-4. The Asset Tracking form in design mode
Once you've published a form, you can open it from the published address. For example, if a form is published to wombat1/assets.xsn as shown previously, you can open it for data entry by navigating to that address in Internet Explorer or by using the File Open command in InfoPath. Figure 7-7. You can publish forms to web addressesFigure 7-8. The Wizard displays the location of the published form, you can specify an alternate address to publish to another location as wellIn either case, InfoPath opens the form template to create a new XML data file. If you enter data and save the form, InfoPath prompts you for a location to save the data with the default set as your local machine (Figure 7-9). Figure 7-9. Warning: if you open the form template (.xsn), data is saved as a new form (.xml)Since InfoPath forms are generally intended to collect and share data, saving data locally is not what you usually want to have happen! To solve this problem, follow these steps:
Note: Only one user can have the XML data file open for editing at a time. During that time, other users are allowed readonly access only. For shared access, see the section "Share Data." 7.1.4. How it worksWhen in design mode, InfoPath creates form template that contains the information InfoPath uses to display the form, collect data, and save that data. When in user mode, InfoPath interprets that form template to create form data files or to exchange XML data with a database, Web service, or other data source. If you open the form data file in Notepad, you'll see processing instructions that associate that file with InfoPath and with the published location of the form template, as shown in the following XML fragment: Figure 7-10. Open the XML file to enter or view shared data <?xml version="1.0" encoding="UTF-8"?> <?mso-infoPathSolution solutionVersion="1.0.0.4" productVersion="11.0.5531" PIVersion="1.0.0.0" href="http://wombat1/assets.xsn" ?> <?mso-application prog?> <at:assetTracking xmlns:my="http://schemas.microsoft.com/office/infopath/ 2003/myXSD" xmlns:at="http://schemas.microsoft.com/office/infopath/2003/ sample/AssetTracking" xml:lang="en-us"> <at:dateModified xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/ XMLSchema-instance"></at:dateModified> <at:owner> <at:name></at:name> You must change the href attribute shown above in bold if you move the published template to a new location or change its name. Note: SharePoint Form Libraries provide a Relink button that can be used to fix this processing instruction if the Form Library is moved. If you open the template file (.xsn) in Notepad, you might be surprised to find that you can't read itit's just a bunch of gobbledygook! Templates are actually compiled from a collection of different files. To see the contents of a form template:
|
|