This is the third of four free labs Qdabra is offering to help people learn how to build InfoPath forms. We’re working with a form template for an event (think Evite), and I hope you’re already thinking about what electronic form you can create for your company or organization.
In Lab 2, you made your Infopath form template look and work better. In this lab, we will make it smarter.
-
Investigate using a SharePoint lookup to add guests using the Qdabra Contact Selector
-
Add InfoPath’s default Person/Group Picker control to your view
-
Create a separate view that adds a more advanced contact selector
-
Compare Person/Group Picker with Contact Selector
-
Configure forms to submit to SharePoint and email guests
-
Add a button to open another form
-
Add an Events Web part to the SharePoint homepage that lists events from the Form Library
ADD A SHAREPOINT LOOKUP TO ADD GUESTS USING THE CONTACT SELECTOR
We have included a pre-configured layout of Qdabra’s Contact Selector template part to save you time in configuring the XTP yourself. We will need to use a new XSN for this lab that has the Contact Selector already added to the Guests view.
1. Right click on the Event Planning (After Lab 2) XSN from the Lab 3 folder, and select Design:

2. This will open the template in Design mode in InfoPath. You’ll need to re-save the template, since it was downloaded from another location. On the File tab of the Ribbon, select Save As:

And save the template as Event Planning.
3. From the Page Design tab, make sure View > Guests view is selected.

You’ll see that there is a new section in the Guests view since you worked in the form in Lab 2:
4. Publish your form template to your SharePoint library to test the SharePoint lookup feature. Use the publishing instructions in Labs 1 or 2.
a. Click Open the SharePoint library in the browser and Add document.
b. Type a partial name in the text box provided. You may type in the first three letters of your name, for example. When done, tab out of the field and click Yes if prompted by a security notice dialog.
Note that the search is performed in the SharePoint list: http://<YourSharePointSit> /UserList, i.e. users must exist in this list for you to be able to select them using the Contact Selector XTP.
c. A list of users that match your search string should appear. Select as many users as you wish and click on the corresponding arrow ( ) key.
d. The user’s name will then appear on the right-hand side of the Guest List section. Click on the red button to remove a user.
You may continue selecting and adding users as desired.
ADD PERSON/GROUP PICKER CONTROL TO A VIEW
1. Return to the form template you had opened in Design mode at the beginning of this lab. Place your cursor in the table with the Contact Selector section and add a new row to the table:
a. Right click and select Insert > Rows Below:

2. Merge the table cells in the new row:
a. With the table cells highlighted, right click and select Merge Cells:

3. From the Home tab, add a Person/Group Picker control in the new row:
a. With your cursor in the new row, from the Home tab, click on the Person/Group Picker control:

4. Right click on the newly added control to learn about its properties:
a. Data tab:

The secondary data connection named Context has already been added to this template for use with the Person/Group Picker.
5. Preview your form to try the Person/Group Picker. Multiple users can be added by separating their user names with semi-colons, as in Outlook:

CONFIGURE FORMS TO SUBMIT TO SHAREPOINT AND EMAIL GUESTS
1. Add a SharePoint submit data connection.
a. In InfoPath, go to Data > Data Connections > Add.
b. In the first screen of the Data Connection wizard, select a new connection to submit data and click Next.
c. Select the option to submit data To a document library on a SharePoint site and click Next.
d. In the next screen:
i. Enter the URL to your document library.
ii. For the File name, click on the fx button and enter the formula: concat(my:Details/my:eventTitle, " - ", my:Details/my:hostName)
iii. Click OK, check the box to allow overwrite if file exists, and then click Next.
e. Click Finish to exit out of the wizard.
2. Add an Email submit data connection.
a. Click on the Add button to add another data connection.
b. Select the option to submit data and click Next.
c. Select the option to submit data As an e-mail message and click Next.
d. In the next screen, click on the fx button next to the To: field.

i. Click on the Insert Field or Group… button.
ii. Expand the Guests group and select the GuestList field.
iii. Click OK twice.
c. For the Subject, click on the fx button and enter the formula: concat("You have been invited to the event ", my:Details/my:eventTitle, " by ", my:Details/my:hostName, ".")
d. Click OK. Your current screen should look similar to this:
e. Click Next.
f. In the next screen, select the option to Send only the active view of the form and no attachment.
g. Click Next, Finish, then Close.
3. Customize the email message.
a. Place your cursor inside the box of the ‘Email Messages to Guests’ section.
b. In the Main Data Source, expand the Details group and right-click on the eventTitle field and in the dialog, select More…

c. In the Select a Control dialog, select Calculated value and click OK. This will add the eventTitle field as an expression box in your canvas. Center-align the control to make the alignment appealing. Also make sure to use a light font color in the expression box because the background is dark.
d. Select Page Design tab, and select Designer view.

e. Once again, look for the table under the Image section. Click inside the Image Layout table:
f. In the Layout tab > Select > Table:

Your entire table should now be highlighted in blue. Copy the table to your clipboard by clicking Ctrl + C on your keyboard.
g. In the Page Design tab, select Guests to switch back to the guests view.
h. Place your cursor right under your eventTitle expression box, right click, Paste Options > Merge Formatting.

Center-align to make it appear nice.
e. Make the image smaller by double-clicking on the picture control, going to the Size tab and reducing the Width to 50% or 75%. Do this for both picture controls.
f. Since there will be no picking/uploading new images in this view, delete the two buttons: Upload Image and Pick New Image. You may also delete the section where you see the text ‘Click here to enlarge.’ Make sure to also delete any extra spaces that have been left.
g. From the Main Data Source, drag the message field right under your image control. Remove the label and adjust the spacing as necessary.
h. Delete all other unnecessary text/placeholders.
Your current screen should look similar to this:

4. Add a Send button.
a. Place your cursor under the horizontal line at the bottom part of your Guests view canvas (see ‘<Place your Send button here>’).
b. Select Page Design tab, and select Designer view.
c. Look for the Send button and copy it on your clipboard.
d. Switch back to your Guests view and paste the button under the horizontal line at the bottom section.
e. Click on the button, and then from Home > Add Rule > When This Button is Clicked > Submit Data.

f. The first action would be to submit using the SharePoint Library Submit data connection, so click OK.

g. Add another action to submit using the Email Submit data connection and click OK.

h. The third action would be to Show Message that states something like “The form has been submitted to your SharePoint library and to your guests.”
i. Click OK until all the dialogs are closed.
5. Save your changes, publish to your SharePoint library, and Add document to review your changes.
PROS AND CONS FOR PERSON/CONTACT PICKER VS CONTACT SELECTOR
1. Person/Contact Picker – This is an InfoPath control that allows you to type or select users and groups from a SharePoint site and validate those users against a directory provider.
a. Pros:
i. Person/Group Picker must connect to a SharePoint site to work. This can be done two ways—either publish the form first or add a secondary data source with the site URL.
ii. You can make it a required field.
iii. You can click the address book button to perform a search.

iv. We can add multiple entries by separating entries with a semi-colon.
v. Can add people and groups.
b. Cons:
i. All the entries are separated by ';' separator.
2. Contact Selector – This is a free Qdabra XTP that allows you to add multiple contacts to your form without code or ActiveX.
a. Pros:
i. Can easily add people/group.
ii. Can add multiple entries (repeating section).
b. Cons:
i. Must add ADWS (Active Directory Web service) data connection.
ii. Cannot make it a required field because it’s from secondary data source.
iii. Must change the Xpath expressions in the rules.
ADD A BUTTON TO OPEN ANOTHER FORM
This is an optional step for Lab 3. You can also do this during Lab 4.
1. From the Designer view, copy the Please R.S.V.P. button:

2. Paste the button into the Guests view:

3. Create a new rule for the button with an action to open another published form to fill out, such as the RSVP form you’ll create in Lab 4:

4. After you create and publish your RSVP form in Lab 4, you can edit this rule to point to that published location. Click OK.
ADD A WEB PART
1. Select the document library to which you want to add a Web part, and click Site Actions > Edit Page.

2. Select Page Tools tab > Insert.

3. Select Web Part.

4. Under Categories, select List and Libraries and then choose your document library or list (the one you’re adding a Web part to). This tutorial uses the MyEventPlanner document library as an example.

5. Click Add button located at right most corner of the page.
6. Below is a sample of how the Web part you just added may appear:

7. You can edit your new Web part to modify its properties:

a. Click on the drop down arrow that is located at right upper corner of the Web part, and select Edit Web Part:
b. Under Selected View drop down, select a default view that is All Documents.

c. Click OK.

d. Under the Appearance section, enter a Title for your Web part.

e. Click OK to save your changes. Under the Page tab of the ribbon, you can now click Stop Editing to exit the edit mode:
You are now finished with Lab 3. We’ll release Lab 4 Friday, July 23. If you have any questions, feel free to post them to the Newbie Questions forum. Once you’ve complete these labs, you’ll be ready to become an InfoPath master. Learn about our in-person and online options.
Requirements for the free training labs:
· Microsoft InfoPath 2010 and Microsoft SharePoint 2010 (contribute permissions) - parts of the labs can be completed without SharePoint. While most of the labs can be completed with InfoPath 2007, the instructions and screenshots are for InfoPath 2010.