When you create a new item in SharePoint,
you are provided with a form that enables you to enter data into the
associated list. Sometimes, however, the default SharePoint forms are
not sufficient for capturing data in a complete way because you may
need to look up information from other sources, make one choice field
be dependent on another, and so on. In addition, users may be used to
filling out paper-based forms, so you might want to make a form that
behaves like the paper form. For example, you may want to enable job
applicants to fill out a fairly complex application form.
So do you really need electronic forms? In most
cases, organizations are using SharePoint lists, Word documents, or
Excel worksheets. But a real form package gives you rich design,
validation, prepopulation of information, multiple roles, digital
signatures, and rich security. Take a look at this list of common issues and see if any of these sound familiar:
In your existing forms-submission process,
do you have challenges around incomplete, inaccurate, or lost
information? Do you face challenges around locating that information?
Does it take too long for information to make it to its final
destination(s)? Forms can drive business processes so that these issues
are minimized or eliminated, validating the data by checking it as the
user is supplying it.
Are your users
overwhelmed with the number of business processes or sources of
information that exist within your company? Electronic information
capture helps streamline the complex processes sitting behind forms.
Are people filling out paper forms that need to be rekeyed? Electronic forms capture data at the source.
If you are experiencing any of these issues, you’re
probably a good candidate for capturing information via an electronic
form. InfoPath 2010 is Microsoft’s offering for electronic forms
creation and use. In this section, we describe the process of using an
InfoPath-based electronic form with SharePoint. We focus not on the
technical details of InfoPath, but rather the key integration points
with SharePoint.
Note
The example in this section requires all users (and
the form designer) to have InfoPath 2010 to fill out a form. If you
elect to use browser-based forms created with InfoPath (described in
the next section), you’ll need SharePoint Server 2010 Enterprise.
1. Introduction to InfoPath
InfoPath 2010 is a client application that lets you
visually design forms using layout tables and controls for gathering
data such as text boxes, choice fields, buttons, and so on. In addition
to quickly formatting a form, InfoPath allows you to connect the form
to various data sources such as a database or a SharePoint list. The
interface provides a lot of wizard functionality for tasks such as
submitting the form, but InfoPath also provides for full customization
using Visual Studio Tools for Applications.
Figure 1
shows the home page for InfoPath 2010. From the home page you can
select from a variety of templates to get started or choose to design your own. While InfoPath is used to design the templates, it’s also used to fill in the forms built from these templates.
An InfoPath form can be used in two ways:
If the data in the form is saved to a file, it is
saved as XML with the form schema. While InfoPath can exist and operate
on its own, we are going to focus on how it integrates with SharePoint
through the Forms library template and InfoPath Forms Services. Before
we discuss integration however, let’s start by creating a simple
InfoPath form.
2. Creating an InfoPath Form
From the InfoPath home page, select the blank template. Figure 2
shows the new form with a placeholder for the form title. To build the
form, we are going to use some controls from the Controls group on the
ribbon, and then we are going to use tables from the Insert tab to
format the layout. It’s unclear why Controls is not on the Insert tab,
but that’s a question for the InfoPath team.
So using tables and controls, we are going to put together a layout that looks similar to Figure 3.
The majority of controls are text and date fields; however, the expense
fields are wrapped into one very useful control called the Repeating
Table. The repeating table control allows a user to add additional rows
to the table on the fly—very useful for an expense report.
When you add a control to the form, InfoPath gives
it a default name like field1, all of these fields can be renamed to be
more descriptive like reportDate. As you add fields, you will see them
listed in the Fields panel on the right.
Once all of our controls are added and positioned
using the layout tables, all that is left to do is add a Submit button.
For our expense report we are going to submit it to a SharePoint Forms
library. What this means is when the user clicks the Submit button, the
data will get saved as a new item in the library. To do this, we need
to create a new SharePoint library using the forms template and then in
InfoPath configure the submit action to send the data to our new
library.
Assuming we have our Forms library in place (you
should know how to do that by now), right click the button and select
Button Properties. From the Button Properties dialog, ensure the action
is set to Submit and click the Submit Options ... button. Figure 4
shows the submit options we have. Here, we select to submit to a
SharePoint Document Library. Before we click OK though, we need to
configure a data connection to our SharePoint library as in Figure 5.
Click Add to create a new data connection for the library. The Data Connection Wizard (see Figure 5) steps you through the simple process of connecting to the SharePoint form library we have already created.
To
recap, we now have a fully designed form that will allow the user to
submit data directly to a SharePoint forms library. However, we still
need to make this form available in a central place so our users can
get to it. For this we need to publish it from InfoPath.