In this exercise you will create a new form for the Employees list using InfoPath. This new form will focus on providing a form that is organized to better represent the structure of Employee information.
In this first task you will enable Forms Services on the SharePoint site and open the Employees list form in InfoPath
- Enable the SharePoint Server Enterprise Site Collectionfeatures to enable Forms Services
- In Internet Explorer navigate to https://intranet.contoso.com/sites/InfoPath
- In the Site Actions menu click Site Settings
- In the Site Collection Administration section, click the Site collection features link
- Locate the SharePoint Server Enterprise Site Collection feature in the list
- Click the Activate button to enable the feature
- Open the Employees list form in InfoPath
- Navigate to the Employees list using the navigation bar on the left of the page
- Switch to the List ribbon using the link at the top of the page
Click the Customize Form button in the Employees List ribbon group
This will automatically open InfoPath and load the form for the Employees list
Figure 1
Default Employees List Form
In this task, you will be updating the look and feel of the form.
- Delete the previous form content
- Select all content on the page
- Press the delete key
- Apply a page layout and add the layout tables to the form
- Place the cursor at the top of the page
In the Page Design ribbon tab, click Page Layout Templates and choose the Title Only option
Figure 2
InfoPath Page Layout Template
- Place the cursor on the Add tables text
In the Insert ribbon tab click the drop down arrow on the Tables group and select a 4 column table with no header
Figure 3
Insert 4 Column Table
- Add a second table with 2 columns and a sub header
- Add a third table with 4 columns and a sub header
Delete the third row from each of the table by selecting all cells can pressing the delete key
Figure 4
Empty Layout Complete
- Populate the top section of the form with the employee’s name and title
- Locate the upper table that has 4 columns and two rows
- Select the right three cells on the second row, right click them and click Merge Cells
Drag the First Name item from the Fields task pane on to the first two cells of the first row
make sure both cells are selected to indicate to InfoPath that the left cell should contain the label and the right cell should contain the control
Figure 5
Dragging Fields to the Layout
- Drag the Last Name field into the rightmost two cells of the first row
Drag the Title field to the bottom row
Figure 6
First Section Complete
- Populate the Contact information section of the form
- Click the first Click to add subheading item and enter Contact Info
- Drag the cell dividers in the table to make the first column about 25% of the total width
- Drag the Phone field into the two cells on the top row
Drag the Email field into the two cells on the bottom row
Figure 7
Contact Info Complete
- Populate the General Information section of the form
- Click the remaining Click to add subheading item and enter General Information
- Drag the Department Name field into the left two cells on the first row
- Drag the Hire Date field into the right two cells on the first row
- Drag the Salaried field into the left two cells on the bottom row
- Drag the Base Rate field into the right two cells on the bottom row
- Apply a new Theme to the form
- Click the Themes drop down button in the Page Design ribbon tab
Choose a theme to apply to the form
Figure 9
Employee Form with a Theme
In this task, you will publish the Employees list form back to SharePoint.
- Add a calculated value in the form header that will display the First Name and Last Name
- Click the Click to add title text at the top of the form
- Locate the Controls group in the Home tab group
Click the drop down in the Controls Group and click the Calculated Value item
Figure 10
Calculated Value Control
In the Insert Calculated Value dialog click the Fx button
Figure 11
Insert Calculated Value Dialog
- Click the Insert Function button
- Chose the Text option in the Categories list and select the concat function
Click OK to close the Insert Function dialog
Figure 12
Insert Formula Dialog
- Double click the first double click to insert field
- Choose First Name and click OK
- Single click the second link and type “ “
Double click the last double click to insert field and select Last Name
Figure 13
Completed Full Name Formula
- Click OK to complete the formula then click OK to complete the control
- Define rules to set disable the Base Rate control when the Salaried check box is set
- Right click the Base Rate text box and choose Rules -> Manage Rules to show the Rules task pane
- In the Rules task pane click the New button and select Formatting
Click the None link in the Condition section
Figure 14
Base Rate Disabled Rule
- In the Condition drop down select Salaried in the first drop down list
In the last drop down choose TRUE and click OK
Figure 15
Salaried is true condition
- In the Rules task pane, check the Disable this control check box
- Define a default value for the EmployeeID field
- In the Fields task pane, right click EmployeeID and select Properties
- Enter 0 in the Default Value text box
- Click OK to close the dialog
- Publish the form using the Info tab in BackStage
- Click the Backstage button (labeled as File)
- In the Info tab, click the Quick Publish button
You can also publish using the Quick Publish button on the Quick Access Toolbar or in the Publish tab in BackStage and choosing SharePoint List
Exercise 1 Verification
In order to verify that you have correctly performed all steps of Exercise 1, proceed as follows:
Test your form to verify it is use to add or edit items in the Employees list.
- Load the Employees list in the browser
- In Internet Explorer navigate to https://intranet.contoso.com/sites/InfoPath
- Click the Employees link in the left side navigation tree
On the employees page click the New Item button in the Items ribbon tab to load the custom form
Figure 16
New Employee Form
- Create a new employee and submit it using the custom form
- Edit an existing employee using the custom InfoPath form
- Click the first employee’s employee id to load a read only form
Click Edit item to see the edit view of the InfoPath form
Figure 17
Edit Employee Form