Designing Forms for Microsoft Office InfoPath and Forms Services 2007

  

  Designing Forms for

Microsoft Office InfoPath

and Forms Services 2007

  Designing Forms for Microsoft Office InfoPath and Forms Services 2007

  Scott Roberts Hagen Green

  Indianapolis • Boston • Upper Saddle River, NJ San Francisco •

  • New York Toronto Montreal London Munich Paris •
  • Madrid Capetown Sydney Tokyo Singapore Mexico City

  

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks.

Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations

have been printed with initial capital letters or in all capitals.

  

The .NET logo is either a registered trademark or trademark of Microsoft Corporation in the United States

and/or other countries and is used under license from Microsoft.

The authors and publisher have taken care in the preparation of this book, but make no expressed or implied war-

ranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or con-

sequential damages in connection with or arising out of the use of the information or programs contained herein.

The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special

sales, which may include electronic versions and/or custom covers and content particular to your business,

training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales

  (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United States please contact: International Sales international@pearsoned.com

  Visit us on the W Library of Congress Cataloging-in-Publication Data Roberts, Scott, 1969– Designing forms for Microsoft Office Infopath and forms services 2007 / Scott Roberts, Hagen Green. p. cm. Includes bibliographical references and index.

  ISBN 0-321-41059-9 (pbk. : alk. paper) 1. Microsoft InfoPath. 2. Business—Forms—Computer programs. I. Green, Hagen. II. Title. HF5371.R63 2007 651'.29028553—dc22

  2006036478 Copyright © 2007 Pearson Education, Inc.

All rights reserved. Printed in the United States of America. This publication is protected by copyright, and per-

mission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system,

or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For

information regarding permissions, write to:

  Pearson Education, Inc. Rights and Contracts Department

  75 Arlington Street, Suite 300 Boston, MA 02116 Fax: (617) 848-7047

  ISBN 0-321-41059-9 Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts. First printing, February 2007

  

To my wife, Andrea, and my two sons, Sean and Bradley.

It is due to your constant love and support that I was able to

complete this project. Thank you for always being there for me

no matter what project I undertake. I love you all a million times

more than you could ever possibly know.

  

—Scott

To Jaime, my love and my life, for putting up with my two jobs

and helping me stay strong through the end. And to my parents,

  

Stuart and Christine, for their perseverance in love and for being

the best parents anyone could ask for.

  

—Hagen

  This page intentionally left blank

  Contents at a Glance List of Figures xxi List of Tables xlvii Foreword li Preface lv About the Authors lxv

  PART I Designing Forms 1

  1 Introduction to InfoPath 2007 3

  2 Basics of InfoPath Form Design 25

  3 Working with Data 85

  4 Advanced Controls and Customization 155

  5 Adding Logic without Code 215

  6 Retrieving Data from External Sources 241

  7 Extended Features of Data Connections 297

  8 Submitting Form Data 327

  9 Saving and Publishing 397

  10 Building Reusable Components 431

  11 Security and Deployment 455

  12 Creating Reports 553

  13 Workflow 613

  14 Introduction to Forms Services 665

  vii PART II Advanced Form Design 727

  15 Writing Code in InfoPath 729

  16 Visual Studio Tools for Microsoft Office InfoPath 2007 833

  17 Advanced Forms Services 865

  18 Hosting InfoPath 965

  19 Building Custom Controls Using ActiveX Technologies 1037

  20 Add-ins 1073

  21 Importers and Exporters 1115 Appendix: Further Reading 1149

  Index 1157 Contents at a Glance viii

  Contents

  

  

  

  Using the Layout Task Pane 34 Color Schemes 39

  ix x Contents

   Standard Controls 43

Repeating and Optional Controls 49

File and Picture Controls 67

   Control Formatting 78 Format Painter 79

Formatting Multiple Controls 80

  

   Creating the Data Source Automatically 86 Understanding Data Source Details 93

   Name Property 95 Data Type Property 98 Cannot Be Blank Property 101 Repeating Property 102 Default Value Property 106 Data Source Details 108

   Adding Nodes 116 Moving Nodes 119 Deleting Nodes 121 Referencing Nodes 122 Starting with Your Own Data Source 124

  

Understanding Data Binding 138

Design-Time Visuals 149

  

  

  Hyperlink 156 Expression Box 158 Vertical Label 163 Scrolling Region and Horizontal Region 164 Choice Group, Repeating Choice Group, and Choice Section 167 Repeating Recursive Section 171 Custom Controls 173

   Data Tab 176 Display Tab 182 Size Tab 189 Advanced Tab 193 Creating Master/Detail Relationships 198

   Editing Default Values 204 Customizing Commands 210

  

  

  Adding Data Validation to a Form Template 223 Pattern Matching 227

  

  Why Do We Need Them? 242 Contents xi xii Contents

  Conceptually Understanding Data Connections and Data Sources 242 All Data Connections Are Not Created Equal 244 Creating a Data Connection 245

   Setting Up a Connection to a Database 257 Integrating the Database Connection into the Form Template 268

   What Is a Web Service? 273 Creating a Simple Web Service Using Visual Studio 2005 274 Using the Simple Web Service 279 InfoPath Web Services 280 Web Service Repository 291

  

  

  Searching with UDDI 299 ADO.NET Web Services 300

  Designing the Form Template 307 Filling Out the Form 310

  Showing Secondary Data in a List Box Control 317 Using the Main Data Source for List Box Items 321 Filtering List Box Items 323

  

  

  Using the “Form-Only” Model to Disable Save 329

Issues with Data Validation and Submitting Forms 331

  Contents xiii

  Introduction to Submit Data Connections 334 What Submit Method Is Best for My Form Template? 335 Submitting via E-Mail 337 Submitting to a Database 341 Submitting to a Web Service 344 Including Text and Child Elements Only 358

  XML Subtree, Including the Selected Element 361 Entire Form 362 Submitting Digitally Signed Form Data 365

   Designing a Form Template with a Dataset 370 Filling Out the Dataset Form 375 Submitting to a SharePoint Library 377 Submitting to a Web Server via HTTP 380 Custom Submit Using Form Code 383 Custom Submit Using Rules 384 Submitting to a Hosting Environment 391

  

   Network Locations 400 SharePoint or Forms Services 404 E-Mail 413 Installable Form Templates 417 Common Conveniences 420

   With Sample Data 426 With User Roles 427 Domain Simulation 428 Saving Form Data 429

   xiv Contents

  

  Template Part Design Mode 434

  Adding a Template Part to the Controls Task Pane 438 Inserting a Template Part into a Form Template 442

  Updating a Form Template That Contains the AddressBlock Template Part 449 Locating All Template Parts That Need to Be Updated 451

  

  

  Designing Security into Form Templates 459 Restricted Security Level 460 Domain Security Level 467 Automatic Security Level 482 Full Trust Security Level 484

   Trust Center 499 Designer Lockdown 504

  

Using Digitally Signed Data in Forms 509

Allowing Only One Signature 527 Using Independent Signatures (Co-signing) 531 Setting Up Counter-Signatures 532 Digital Signatures in the XML Data and Schema 533

   Permission on Form Templates 539 Permission on Forms 542

  Contents xv Permission with Document Libraries 548

  

  

  Merging Forms in InfoPath 555 Design Recommendations for Merging Forms 561 Customizing Merge Behavior in Design Mode 564 Custom Merge XSL (Advanced) 580

   Print Views 586 Headers and Footers 589 Multiple View Printing 592 Word Print Views 596 Print Views in Browser-Enabled Forms 603

  

  

  Creating User Roles 616 Determining a User’s Role When Filling Out a Form 620 User Roles in Action 621 Role-Based Views 631

  

  Designing and Using InfoPath E-Mail Forms 644 Creating Rules for InfoPath E-Mail Forms 648 Storing Received Forms in Outlook Folders 650 Filling Out an InfoPath E-Mail Form 652 Sorting, Grouping, and Filtering Responses 656 Merging and Exporting InfoPath E-Mail Forms 657 Customizing E-Mail Support for a Form Template 660

   xvi Contents

   Why Use the Browser? 668 What Is Forms Services? 669

  

Installing Forms Services 673 Configuring Forms Services 675 Is Forms Services Installed? 677

   Creating a New Form 682 Toolbar 683 Controls 688 Supported Web Browsers 690

   Design Once 692 Design Checker 693 Browser-Enabled Forms without the Design Checker 701

Designing Browser-Enabled Template Parts 701

   Document Libraries 705 Site Content Type 709

   Data Connection Libraries 711 Security and Data Connection Libraries 713

  

Configurations Supported by Forms Services 715

URL-Based Options 716

   Mobile Compatibility 722 Filling Out a Mobile Form 725

  

  

  

  Settings Related to Adding Code 732 Adding Code to a Form Template 737 Filling Out and Debugging a Form with Code 738

   Form Events 742

  XML Data Events 744 Using XPathNavigator Objects 777 Registering Event Handlers 780 Script and the Custom Task Pane 782

   The MOI Consulting Request Form 791 Filling Out the MOI Consulting Request Form 792 Designing the MOI Consulting Request Form 797

  

  

  Start Designing a Form Template 837 The VSTO Design Experience 843 The VSTO Feature Set 853 Missing Features in VSTO 861

   Contents xvii xviii Contents

   Postback Settings 871 The Update Button 872 Designing Accessible Forms 874

   Executing Form Code in the Browser 876 Circumventing Browser-Enabled Limitations 878 Detecting the Browser or the InfoPath Client 883 Form Code Compatibility with Forms Services 884

   Advanced Publishing 888 Managing Form Templates 904 Configuring InfoPath Forms Services 906 Configuring Shared Services and Providers 907 Filling Out a Form on a SharePoint Page 928

   Data Connections Administration Settings 931 Centrally Managed Connection Library 936

Authentication Considerations 943

E-Mail Data Connections 948

   Form Template Deployment 951 Views 952 Form Code 953 Reduction of Form Postbacks 953 Data-Heavy Features 954 Data Connections 956 Form View State 956

Miscellaneous Performance Tips 957

Performance Monitoring 958 Health Monitoring 962

  

  

  Creating an InfoPath Host Application in .NET 979 Host to InfoPath Communication 990 Handling Events from the Form 1001 Using the Host Property 1004 Submitting a Form to the Host 1007

   Host to InfoPath Communication 1020 InfoPath to Host Communication 1028

  

  

  Adding an ActiveX Control to the Controls Task Pane 1038 Property Pages 1047

  Building an ActiveX Control for InfoPath Using C++ 1049 Building an ActiveX Control for InfoPath Using C# 1061

  

  IDTExtensibility2 Interface 1075 Adding User Interface Items 1076

   OnConnection Method 1079 OnStartupComplete Method 1083 Event Handlers for Loading a Form 1088 Copy and Paste Button Event Handlers 1090

  Contents xix

   Creating a Custom Task Pane 1093

   Implementing a Managed Add-in 1105 Adding a Custom Task Pane in a Managed Add-in 1108

  

   Importing a Form into InfoPath 1119 Fixing the Imported Form 1125 Post-Import Warnings 1126

   InfoPath Import/Export Framework 1128 How Post-Import Warnings Work 1140

   Data Importer Framework 1142

  IInfoPathDataImporter Interface 1143

  

  Contents xx

   Figure P.1:

  Open With Form Template dialog lviii Figure P.2:

  

Dialog shown when InfoPath cannot find the Visual C# project

with the form code lx Figure 1.1:

  Controls task pane in InfoPath 2003 8 Figure 1.2:

  Data Source task pane in InfoPath 2003 9 Figure 1.3:

  Insert Layout Table toolbar item 13 Figure 1.4:

  Tables toolbar 13 Figure 1.5:

  Fill Out a Form dialog in InfoPath 2003 SP1 17 Figure 1.6:

  Filling out a browser-enabled form template in Internet Explorer 18 Figure 1.7:

  Getting Started dialog 21 Figure 1.8:

  Design a Form Template dialog 22 Figure 2.1:

  Getting Started dialog 27 Figure 2.2:

  Design a Form Template dialog 28 Figure 2.3:

  New blank form 33 Figure 2.4:

  Layout task pane 35 Figure 2.5:

  Employment application form template with title added by using Table with Title 36 Figure 2.6:

  Merge and split cells category of the Layout task pane 37 Figure 2.7:

  Employment application form template with cells for first and last names 38 Figure 2.8:

  Employment application form template with a row for address information 38

  xxi Figure 2.9: Color Schemes task pane 40

  Figure 2.10: Controls task pane 42

  Figure 2.25: Repeating Table control after changing from a Repeating Section control 58

  Figure 2.36: Multiple-Selection List Box control when filling out a form 67

  Figure 2.35:

List controls when filling out a form 66

  Figure 2.34: List controls in design mode 66

  Figure 2.33: Binding design-time visual showing the name of the control 65

  Figure 2.32: Master/Detail control showing more applicant data 64

  Figure 2.31: Master/Detail control in the application review form when filling out a form 64

  Figure 2.30: Master and detail controls in design mode 63

  Figure 2.29: Insert Master/Detail dialog 63

  Figure 2.28: Horizontal Repeating Table control when filling out a form 62

  Figure 2.27: Horizontal Repeating Table control in design mode 61

  Figure 2.26: Repeating Table control when previewing the form 60

  Figure 2.24: Change To menu 58

  Figure 2.11: Employment application form template after adding standard controls 46

  Figure 2.23:

Repeating Table control in design mode 57

  Figure 2.22: Insert Repeating Table dialog 57

  Figure 2.21: Three instances of the Repeating Section control inserted into the form 55

  Figure 2.20: Context menu for Repeating Section control when previewing the form 54

  Figure 2.19: Repeating Section control when previewing the form 54

  Figure 2.18: Employment application form template with Repeating Section control 53

  Figure 2.17: Context menu for the Optional Section control when filling out a form 52

  Figure 2.16: Optional controls after clicking on the link, Click here to insert 51

  Figure 2.15: Optional controls when previewing the form 51

  Figure 2.14: Employment application form template with Optional Section controls 50

  Figure 2.13: Preview of the employment application form 48

  Figure 2.12:

Section control selected in design mode 47

  Figure s xxii

  Figure s xxiii Figure 2.37:

  File Attachment control in design mode 68 Figure 2.38:

  File Attachment control when filling out a form 68 Figure 2.39:

  File Attachment control with résumé file attached 69 Figure 2.40:

  File Attachment control commands 69 Figure 2.41:

  Insert Picture Control dialog 71 Figure 2.42:

  Picture control when filling out the form 72 Figure 2.43:

  Picture control with picture inserted 72 Figure 2.44:

  Ink Picture control that contains text entered with a Tablet PC stylus 73 Figure 2.45:

  Views task pane 74 Figure 2.46:

  Add View dialog 75 Figure 2.47:

  View Properties dialog 75 Figure 2.48:

  Font task pane 77 Figure 2.49:

  Selected Text Box control 78 Figure 2.50:

  Format Painter on the Standard toolbar 79 Figure 2.51:

  Format Painter cursor 80 Figure 2.52:

  Text Settings tab in the View Properties dialog 83 Figure 3.1:

  Clicking on a control in the view to select the bound control in the data source 87 Figure 3.2:

  

A Hyperlink control bound to field1 in the data source, with a link

to the text of field1 88 Figure 3.3:

  Warning dialog when changing the name of a data source field or group for a published form 97 Figure 3.4:

  Data type validation error that occurs when a field contains invalid data 100 Figure 3.5:

  Warning when saving a form with validation errors 100 Figure 3.6:

  Validation error for the cannot be blank property, delineated by a red asterisk 102 Figure 3.7:

  

Repeating field4, which is bound to the Numbered List control

and repeats in group1 104 Figure 3.8:

  Airline form with default value for FlightType as "Roundtrip" 106

  Figure 3.9: The default value calculation button 107

  Figure 3.10: The Insert Formula dialog, with a formula that sets this field’s default value to today’s date plus 45 days 107 Figure 3.11: Data source details for the FlightType field bound to the option buttons in the airline form 108

  Figure 3.12: Label for the node PurposeOfVisit, created when inserting the control into the view 118

  XML Schema or XML document 134 Figure 3.24:

  , which contains Attribute 145 Figure 3.31: NumberOfChildren attribute field, which is bound to both the Optional Section and the Drop-Down List Box inside of the

  

An absurd control nesting: Attribute contains

DocumentElement

  Inserting field1 in the data source 144 Figure 3.30:

  Dialog that results from clicking More on the menu shown in Figure 3.27 143 Figure 3.29:

  Context menu of most popular control bindings 143 Figure 3.28:

  Changing binding via the context menu by right-clicking on any control that can be bound 140 Figure 3.27:

  Text Box Binding dialog that appears when Automatically create data source is disabled or Change Binding is used from a control 139 Figure 3.26:

  Data source created from the XML document 136 Figure 3.25:

  Figure 3.23: The Type drop-down menu, with an option for adding a complete

  Figure 3.13: Move Field or Group dialog used to move an existing field or group 119

  Figure 3.22: Prompt that appears when starting from a schema with multiple top-level elements 131

  Figure 3.21: Disambiguating the data source by using the Edit Settings dialog 130

  Figure 3.20: The first prompt when starting from an ambiguous schema 129

  Figure 3.19: Choosing whether to include data from a selected XML file as the form template default data 127

  Figure 3.18: Selecting the location of an XML document or schema 125

  Figure 3.17: Design a form from an existing XML document or schema instead

of creating the data source from scratch 125

  Figure 3.16: Filling out the MOI Company’s employee information form 124

  Figure 3.15: Setting the Employee group to repeat and reference itself 123

  Figure 3.14: Validation error that appears when opening a form created before

the FlightType–FlightDate node swap 121

  Optional Section 146 Figure s xxiv

  Figure s xxv Figure 3.32: NumberOfChildren attribute is nonexistent in the form and XML data 147

  Figure 3.33: NumberOfChildren attribute field inserted in the form and XML with a default value of 1 147

  Figure 3.34: A simple repeating field: field1 147

  Figure 3.35: Three controls multiply bound to field1 148

  Figure 3.36:

Critical design-time visual on an unbound Text Box control 150

  Figure 3.37: Edit Default Values dialog, which offers the quickest way to edit data source defaults 152

  Figure 3.38:

Cutaway of the Edit Default Values dialog when Choice exists

in the data source 153

  Figure 4.1: Insert Hyperlink dialog 157

  Figure 4.2: Select a Field or Group dialog 157

  Figure 4.3: Hyperlink control in design mode 158

  Figure 4.4: Insert Expression Box dialog 159

  Figure 4.5: Insert Formula dialog after choosing a field 159

  Figure 4.6:

Insert Formula dialog after checking the Edit XPath checkbox 160

  Figure 4.7: Insert Function dialog 160

  Figure 4.8: Repeating Table control for expenses 161

  Figure 4.9: Data source for the expense report example 161

  Figure 4.10: Insert Formula dialog after inserting the sum function 162

  Figure 4.11: Expense report form during preview 163

  Figure 4.12: Insert Vertical Label dialog 164

  Figure 4.13: Vertical Label control 164

  Figure 4.14: Scrolling Region control in design mode 165

  Figure 4.15: Application review form with Scrolling Region when filling out the form 166

  Figure 4.16: Horizontal Region controls in design mode 167

  Figure 4.17: Choice Group control in design mode 168

  Figure 4.18:

Employment application form with Choice Group control 170

  Figure 4.19: Default Choice Section with context menu commands 170

  Figure 4.20: Employment application form after replacing the default Choice Section 170

  Figure 4.21: Repeating Recursive Section in design mode 172 Figure 4.22: Repeating Recursive Section when filling out the employee information form 173

  Figure 4.23:

Properties dialog for the Text Box control 175

  Figure 4.40: Input Scope dialog showing custom input scopes 197

  Section Commands dialog used to customize commands 210 Figure 4.53:

  Filling out the grocery shopping list 209 Figure 4.52:

  , and Bananas 209 Figure 4.51:

  Figure 4.50: Repeating Section Properties dialog showing three sections—Apples, Oranges

  Figure 4.49: Section Properties dialog for a Repeating Section fragment 208

  Figure 4.48: Repeating Section Properties dialog 207

  Figure 4.47: Edit Default Values dialog for an Optional Section control 206

  Figure 4.46: Section Properties dialog for an Optional Section control 205

  Figure 4.45: Master/Detail control when filling out a form 204

  Figure 4.44: Master/Detail tab for a Repeating Section set as a detail control 202

  Figure 4.43: Master/Detail tab for a Repeating Table set as the master control 200

  Figure 4.42: Sample data source for the Master/Detail example 200

  Figure 4.41: New Input Scope dialog showing Phrase List option 197

  Figure 4.39: Input Scope dialog showing standard input scopes 196

  Figure 4.24: Dialog that warns about data loss when changing field names 177

  Figure 4.38: Advanced tab of the Text Box Properties dialog showing the Input recognition section 194

  Figure 4.37:

Advanced tab for the Hyperlink control 193

  Figure 4.36: Properties dialog for resizing multiple controls 192

  Figure 4.35: Text Box control with inner text aligned to outer text 191

  Figure 4.34: Text Box control with inner text not aligned to outer text 190

  Figure 4.33:

Size tab of the Text Box Properties dialog 189

  Figure 4.32: Insert Picture dialog 187

  Figure 4.31:

Display tab for the Rich Text Box control 186

  Figure 4.30: Placeholder text in a Text Box control 184

  Figure 4.29: Display tab of the Text Box Properties dialog 183

  Figure 4.28: Properties dialog for the Optional Section for the minimum salary desired 181

  Figure 4.27: Field for minimum salary desired formatted as currency 179

  Figure 4.26: Integer Format dialog for Whole Number (integer) data types 179

  Figure 4.25: Binding design-time visual for the FirstName Text Box control 178

  Default commands for a Choice Section when filling out a form 212 Figure s xxvi

  Figure s xxvii Figure 5.1:

  Conditional Formatting dialog 216 Figure 5.2:

  Conditional Format dialog 217 Figure 5.3:

  Conditional Format dialog with multiple conditions 219 Figure 5.4:

  Conditional Format dialog with condition, where StockPrice is less than or equal to $18.00 220 Figure 5.5:

  Conditional Formatting dialog with one condition 220 Figure 5.6:

  Conditional Format dialog specifying the four conditions needed to set the background color to yellow 221 Figure 5.7:

  

Conditional Formatting dialog showing all three conditions 222

Figure 5.8:

  Data Validation dialog 223 Figure 5.9:

  Validation tab on the Field or Group Properties dialog 224 Figure 5.10:

  Data Validation condition builder 225 Figure 5.11:

  Inline alert for a data validation error 225 Figure 5.12:

  Full error description for a data validation error 226 Figure 5.13:

  

Data Validation dialog listing two conditions to validate the total

number of guests 227 Figure 5.14:

  Data Entry Pattern dialog 228 Figure 5.15:

  Red asterisk error 228 Figure 5.16:

  Custom pattern 229 Figure 5.17:

  Adding or modifying an existing rule so that four actions are always run when the form is submitted 230 Figure 5.18:

  

Specifying the action for a rule to run when a user clicks the Button

control 231 Figure 5.19:

  Entry points and structure of the Rules feature 232 Figure 5.20:

  Dialog displayed when an action on a rule fails to execute when the user fills out the form 234 Figure 5.21:

  Form template for the Logic Inspector sample 236 Figure 5.22:

  

Logic Inspector showing the logic for the entire form template 237

Figure 5.23:

  Detailed view of the DataValidation node 239 Figure 6.1:

  

Relationships between a form and its external data sources 243

Figure 6.2:

  Design a Form Template dialog, the starting point for creating a main query connection 245 Figure 6.3:

  

Creating a secondary query connection for a form template 246

Figure 6.4:

  Data to fill into a form and save to Sample.xml, to be read later by using an XML file adapter 248 xxviii Figure s

  Figure 6.5: Entering the file location to use when creating a secondary connection to XML data 249

  Figure 6.6:

  XML file connection settings to opt in or out of including the data as a file in your template 249 Figure 6.7:

  Final page of the Data Connection Wizard for an XML file 251 Figure 6.8:

  Data Connections dialog after finishing the XML file Data Connection Wizard 252 Figure 6.9:

  Data Source task pane showing secondary data source 253 Figure 6.10:

  Clicking on the Button to query the Sample data connection 254 Figure 6.11:

  Data Connection Wizard when creating a new database connection 259 Figure 6.12:

  Connecting to SQL Server after clicking Select Database 260 Figure 6.13:

  Select Database and Table dialog 261 Figure 6.14:

  Database connection’s data source structure showing the added Customers and Orders tables 262

  Figure 6.15: Adding the Orders child table to the Customers parent table 262

  Figure 6.16: Defining a relationship between the child and parent tables 263

  Figure 6.17: Sort Order dialog for setting three levels of sorting order 265

  Figure 6.18: Edit SQL dialog, which allows hand-editing of the query statement

used by InfoPath to create the data source 267

  Figure 6.19: Customers secondary data source 268

  Figure 6.20: A nested database table (Orders), which is hard to represent when the parent table (Customers) is in the view as a Repeating Table 270

  Figure 6.21: Our rendition of displaying the Customers and Orders data 271

  Figure 6.22: Preview of the modified form layout with Northwind customers and orders data 272

  Figure 6.23: New Web Site dialog with a template for an ASP.NET Web service 274

  Figure 6.24: Part of the browser-friendly test page when navigating to the Web service 278

  Figure 6.25: Browser test form for the SaveItem Web service method 280

  Figure 6.26: Entering an address to the WSDL 281

  Figure 6.27: List of methods from the Web service that can be used to receive data 283

  Figure 6.28: Setting up the parameter to the SaveItems Web service method, which involves selecting which data source node provides its value 284

  Figure 6.29: Choosing the data source node to submit to the SaveItems method 285

  Figure s xxix Figure 6.30:

  InfoPath design mode after finishing the Web service Data Connection Wizard 286 Figure 6.31:

  Querying and submitting our Web service form during preview 287 Figure 6.32:

  Designing the TerraServer form using the GetTile Web service method 290 Figure 6.33:

  Querying the TerraServer for a section of the San Francisco Bay near Highway 80 291 Figure 6.34: Pictures library on Windows SharePoint Services 293

  Figure 6.35: The libraries and lists available for querying from the SharePoint server 293

  Figure 6.36:

Choosing which fields from the SharePoint list you want to use for

the data connection 294

  Figure 6.37: Filling out the music and photos form 295

  Figure 7.1: Searching for Web services by using UDDI in InfoPath 300

  Figure 7.2: Creating a typed dataset from our Customers and Orders SqlDataAdapter objects 304

  Figure 7.3: The Visual Studio schema editor 305

  Figure 7.4: Adding a relationship to the Customers and Orders tables in the dataset 305

  Figure 7.5: Secondary data source–bound controls allow for little customization 308

  Figure 7.6:

Form after querying the XML file secondary data connection 310

  Figure 7.7:

Enabling query support for offline mode when adding or modifying

a secondary data connection 313

  Figure 7.8: Configuring a form template for offline mode queries 313

  Figure 7.9: InfoPath global cached queries setting 315

  Figure 7.10: Error dialog shown if querying an external data source fails when filling out the form 315

  Figure 7.11: Error dialog that results from clicking Try to Connect in Figure 7.10 if the data connection is unavailable 316

  Figure 7.12: Grocery list form template, unchanged, from Chapter 4 318

  Figure 7.13: Drop-Down List Box Properties dialog 319

  Figure 7.14: Selecting a secondary data source node from the XML file connection that provides data for the List Box entries 319

  Figure 7.15: Filling out the grocery list form when the items are retrieved from a data connection 320 xxx Figure s

  Figure 7.16: Using the main data source to provide data for a List Box control 321

  Figure 7.17: Adding a note-taking capability to our grocery form 322

  Figure 7.18: Filling out the form after we’ve added the note-taking feature 322

  Figure 7.19: Specifying a filter to show only grocery items from a selected category 324

  Figure 7.20: Filling out the grocery form with category filters 325

  Figure 8.1: Dialog asking the user whether to save or submit the form 329

  Figure 8.2: Settings for enabling and disabling certain features for users, such as the ability to save a form 330

  Figure 8.3:

The first view of the job application form 332

  Figure 8.4:

The last page of the job application form 333

  Figure 8.5: Dialog about the submit error that occurs when the user clicks the Submit button after not filling in a name in the first view 333

  Figure 8.6: Submit Options dialog, the starting point for enabling submit 335

  Figure 8.7: First page of the Data Connection Wizard for setting properties of the e-mail sent when users submit the form 338

  Figure 8.8: Configuring the attachment options for submitting via e-mail 340

  Figure 8.9: Dialog prompt in which the user must click Send in order to submit a helpdesk request 341

  Figure 8.10: Specifying whether your form only receives data, only submits data, or does both with a Web service 346

  Figure 8.11:

Selecting a Web service method for submit 348

  Figure 8.12: Design mode after finishing the Data Connection Wizard for submitting data to a Web service 348

  Figure 8.13: Error dialog that results when submitting a form with validation errors that are in the current view 349

  Figure 8.14: Student sign-in form during preview 350

  Figure 8.15:

Dialog confirming that submit succeeded 350

  Figure 8.16: Student sign-in form showing the instructor’s Class Information view with default data 352

  Figure 8.17: Designing the sign-in form view 354

  Figure 8.18: Configuring conditional formatting to hide the LateReason section if the start time is later than now 354

  Figure 8.19: Setting custom data validation to make the Reason field required when the LateReason section is visible 355

  Figure 8.20: Defining parameter mappings for Web service submit 356

  Figure 8.34:

Error that results from trying to modify dataset form data after

submit 376

  Figure 8.46:

Dialog shown when submit using rules fails on the main submit

connection 391

  Figure 8.45:

Dialog that appears when submit with rules fails on a secondary

connection 390

  Figure 8.44: Dialog that appears when Johnny signs in tardy 388

  Figure 8.43:

Expression shown in a popup message when a student signs in late

to class 387

  Figure 8.42: Actions for the actual submit to the Web services 387

  Figure 8.41: List of rules that run when the form is submitted 386

  Figure 8.40: Setting up submit using rules 385

  Figure 8.39: Setting the destination option to use an ASP.NET page 381

  Figure 8.38: Submit Options dialog for Web server submit via HTTP 381

  Figure 8.37: SharePoint document library that contains submitted form data 380

  Figure 8.36: Submit Options dialog configured to submit to a SharePoint document library 379

  Figure 8.35:

Configuring SharePoint document library submit for the student

sign-in form 378

  Figure 8.33: After querying the form shown in Figure 8.32 375

  Figure 8.21: Tardy Johnny signs in to Philosophy 101 357

  Figure 8.32: Filling out a dataset form template with default data 375

  Figure 8.31: Designing the view of the form receiving and submitting an ADO.NET DataSet object 374

  Figure 8.30: Data source representative of a dataset structure 373

  Figure 8.29: Setting up a parameter mapping for a DataSet object 372

  Figure 8.28: Configuring change tracking for an ADO.NET dataset Web service 371

Figure 8.26 368

  Figure 8.27: Controlling whether or not to display the prompt shown in

  Figure 8.26:

Dialog that gives the user a chance to digitally sign a form before

continuing with submit 367

  Figure 8.25: Parameter mappings dialog configured to submit the entire form 363

  Figure 8.24: Data source for the student sign-in form 362

  Figure 8.23: Debugger paused at our breakpoint 360

  Figure 8.22: Debugging the Web service by using Visual Studio 359

  Figure s xxxi xxxii Figure s

  Figure 8.47: Generic success dialog for the main submit connection 393

  Figure 8.48: Generic failure dialog for the main submit connection 393

  Figure 8.49: Advanced section of the Submit Options dialog 393

  Figure 9.1: InfoPath prompt that appears when choosing Save or Save As for a new form template 399

  Figure 9.2: First page of the Publishing Wizard, offering a variety of publishing options 400

  Figure 9.3: Publishing a MeetingRequest template to a Web server via a “backdoor” network share 401

  Figure 9.4: Specifying the users’ access path 402

  Figure 9.5: Error dialog that appears when opening a form from a path that is not the access path 403

  Figure 9.6: Flowchart for determining whether the form template publishes to a SharePoint server or a Forms Services site 404

  Figure 9.7: Specifying a server location for publishing to a SharePoint site or Forms Services site 406