Working with Form Templates


Now that you know the design-related functions of an InfoPath form template, you can start creating some actual form templates that can help you collect and view information. This section discusses creating a new form template, and then addresses some options for publishing and customizing the form to further meet the business requirements.

Designing a New Form

Before you can begin creating a new form, you need to figure out the form’s requirements. This might involve gathering information from the group or sponsors who are requesting the form. However you gather the information, you should know the following:

  • What types of information should the form collect?

  • How should you present the information, and what special rules are there for submitting the information? For example, you can create Name and Email fields because they are required to contact employees after they submit feedback.

  • How should you format the Data field? For example, you may apply special formatting or filtering that disables other fields based on a user’s input in another field. This is helpful to ensure that users only have to deal with the fields they are required to complete.

Once you have the information that you need, it’s time to do the actual work of creating the form template.

Although there are many steps in the next Try It Out, they represent a small portion of the steps required to create the most basic of electronic forms. In the second Try It Out of this section, you look at the new functionality of InfoPath 2007 related to creating reusable template components called template parts.

Try It Out-Design a New Form Template

image from book

For this example, you first set up the layout of the form. This helps mold the canvas for how the form will look. It is also recommended that prior to opening the InfoPath application you should always sketch out how you want the form to look on a piece of paper. This is something that can be helpful for collecting feedback from your sponsors prior to starting any development work. As you see in the exercise, sometimes there can be many steps to creating even the most basic of forms. Therefore, it is always a good idea to have a solid roadmap before you even start.

Once the layout is defined, you begin adding controls and creating the data source. In this situation, every time you add a new control to the page, it creates a new data source field. You name the fields as you go along to keep things organized and easy to follow. This is very important as forms become more complex and large numbers of fields are created.

  1. Open the InfoPath application.

  2. From the Getting Started window, select Design a Form Template from the Design a Form action group.

  3. Specify that you want to design a new Form Template based on a Blank data source.

  4. Select the check box for Enable Browser-Compatible Features Only, as shown in Figure 10-21.

    image from book
    Figure 10-21

  5. Click the OK button. A new blank form view appears.

  6. From the Design Tasks pane, select Layout.

  7. Click to select Table with Title. A table appears in the form template featuring a placeholder title and text.

  8. Click the row containing the form’s title and change it to read Feedback Form.

  9. Click the row below the title and select the Three Column Table item from the Layouts task pane.

  1. Select the left-hand column, click the right mouse button, and select Table Properties as shown in Figure 10-22.

    image from book
    Figure 10-22

  2. Select the Row tab.

  3. For Size, change the value to Automatically Set Row Height.

  4. Select the Column tab.

  5. Enter 300 px for the column width of the left-hand column.

  6. Click the Next Column button.

  7. Enter 50 px for the column width of the center column.

  8. Click the Next Column button.

  9. Enter 300 px for the column width of the right-hand column.

  10. Click the Apply button.

  11. Click the OK button. You will notice that your table is now formatted with two wide columns on each side with a smaller column in the middle.

  12. Select the Design Tasks hyperlink at the top of the Layout task pane, as shown in Figure 10-23.

    image from book
    Figure 10-23

  13. Click the Controls link.

  14. Click in the left-hand column of the table.

  1. Type the word Name and press Enter.

  2. From the Controls task pane, click the text box. Note that if you click the text box with the cursor already positioned in the table, the control is automatically added where you have specified. Otherwise, you can drag the control to your desired location.

  3. Double-click the control to expose its properties, as shown in Figure 10-24. Enter employeeName as the Field Name.

    image from book
    Figure 10-24

  4. Select the Cannot Be Blank check box.

  5. Click the Apply button and then the OK button.

  6. Select the right-hand column of the form table.

  1. Type the words Email Address and press Enter.

  2. From the Controls task pane, click on the text box.

  3. Double-click the control to expose its properties. Enter employeeEmail as the Field Name.

  4. Select the Cannot Be Blank check box.

  5. Click the Apply button and then the OK button. If the Email Address control is still selected, click the right arrow on your keyboard.

  6. Click the Table menu item and select Insert and then Rows Below. A new row is added to the table. Repeat this step once more to add another row. This separates the fields a bit visually, which should make it easier for end users to fill out.

  7. Select the last row in the table with your mouse to highlight each column.

  8. Click Table image from book Merge Cells as shown in Figure 10-25.

    image from book
    Figure 10-25

  9. In the newly merged row, shown in Figure 10-26, enter the text Tell Us What You Think and press Enter.

    image from book
    Figure 10-26

  10. From the Controls task pane, click on the rich text box.

  11. Double-click the control to expose its properties. Enter employeeFeedback as the Field Name.

  12. Click the Apply button and then the OK button.

  13. Click File image from book Save As.

You receive a message window advising you that you will need to publish the form template to make it available to other people. Click the OK button to accept the message and continue.

Save the file on your computer in the location containing the resource files for this chapter. Give the form template a file name of employeefeedback.xsn.

Click the Preview button to see how your form will be viewed by all users.

How It Works

After you finish adding fields and save the form, you preview it. Figure 10-27 demonstrates that the Name and Email Address have a special character within them that communicates to the user that the fields are required.

image from book
Figure 10-27

image from book

Try It Out-Create a Template Part

image from book

In the last example, you looked at the process for creating an entire form template. However, a fantastic new feature in InfoPath 2007 is the ability to create reusable components called template parts. A template part is a section or group of controls that may have specific fields, data connections, or customizations that could be potentially reused across multiple form templates. For example, consider a common contact form. It generally contains a name, email address, phone number, and address. In fact, many other forms also contain this information. Therefore, it’s beneficial to create template parts containing each of those items so that they can be easily added in the future to all other forms requiring those components.

In the next example, you walk through the process of creating a template part in InfoPath 2007.

  1. Open the InfoPath application.

  2. From the Getting Started window, select Design a Form Template from the Design a Form action group.

  3. Specify that you want to design a template part based on a blank data source, as shown in Figure 10-28. You will also design this template part to be supported in the browser.

    image from book
    Figure 10-28

  1. Click the OK button.

  2. From the Controls task pane, select that you want to add a section.

  3. Double-click the section on the form to expose its properties.

  4. Name the section ContactInformation and click the OK button.

  5. Click inside the section and click the Three-Column Table from the Layout task pane.

  6. Change the width of the table columns to be wider within both the left- and right-hand columns.

  7. Add four new text box fields to your form, as shown in Figure 10-29, to represent the name, phone number, email address, and street address fields.

    image from book
    Figure 10-29

  8. When you finish your designing and customization, select File image from book Save As.

  9. Save the template part within your resource files for this chapter using the name ContactInformation.xtp.

  10. Click the Save button.

  11. From the File menu, select that you wish to Design a Form Template.

  12. Select that you want to design a form template based on a blank data source and click OK.

  1. Click the Add or Remove Custom Controls link below the Controls task pane.

  2. Click the Add button. The Add Custom Control Wizard dialog box appears, as shown in Figure 10-30.

    image from book
    Figure 10-30

  3. Select the Template Part option.

  4. Click the Next button.

  5. Browse to the location of the file you saved as part of step 12. Select the ContactInformation.xtp file and click Open.

  6. Click the Finish and then Close buttons to complete the import process. Click the OK button to close the Add or Remove Custom Controls window.

  7. Your new template part appears in the Controls task pane under the Custom category whenever you create a new form template. You can select it to add the fields for contact information to your new form template.

How It Works

Sometimes when creating form templates, you begin to recognize that certain elements appear in multiple form templates. Other times you may find that it requires a significant amount of effort to configure a set of fields and controls to behave the way you require. Therefore, it may be advantageous to wrap the elements into a single package that contains all the customizations and configurations required to reuse it again with very little effort.

In the previous example, you took a set of fields that were contained in many different form templates and created a template part out of them. Once a template part has been added to a control list, it will show up under custom controls whenever you open the InfoPath application. Adding the template part control is exactly the same as adding a single control to a form.

The advantage of using template parts can be calculated by identifying the total amount of time to recreate the form fields and their customizations, and then multiplying that number by the number of times you anticipate the fields would be required or used in a form. This number can be considerably high for common usage scenarios and form elements.

If you work in a team environment where multiple people are creating form templates, it is a good idea to share all the created template parts by storing them in a central location. This should increase the potential benefits of creating template parts because it will likely result in a higher reuse number.

image from book

Publishing a Form Template to a Library

In the previous example, you created a very simple form for users to fill out to provide feedback to a communications group within an organization. Once a form template is created, it must be published to a location where users can fill it out. As previously mentioned in the introduction of this chapter, SharePoint includes support for InfoPath Forms Services, a server feature that allows for users to complete InfoPath Forms via the browser so they do not require the InfoPath application. In order for a site to support this functionality, this Enterprise feature must be activated on the site collection and the site to which the form is being published.

In the first Try it Out in this section, you learn the process for creating a new SharePoint site with the InfoPath Form Services features enabled so that the form template can be made available to users from either the InfoPath application or a browser. For this example, you create a new SharePoint site using the blank template named “Communications.” Creating a new site is not a requirement for publishing a new form template; however, because you will be adding very specific lists for use by this form, you will create a brand-new site from which to work. Once the site is created with the appropriate feature enabled, you explore the process for publishing a form template to a document library in the second Try It Out. Then finally, in the last Try It Out of this section, you learn how to configure a document library to ensure that all users have the same editing experience, and specify that the form is opened as a web page in a browser regardless of whether the user has the InfoPath application installed on their computer.

Try It Out-Activate the Form Services Feature

image from book

InfoPath Form Services is an Enterprise feature that is not enabled by default on the Blank Site template used to create the communications site. Therefore, before you attempt to publish the form template out for your users to complete via the browser, you have to enable the Enterprise feature that controls InfoPath Forms Services. You first enable the feature on the site collection and then on the individual site to which you plan to publish your form.

  1. From your Corporate Intranet site, go to the Sites directory and create a new site using the Blank Site template with Unique Permissions. Give the new site a URL of http://servername/sitedirectory/communications.

  2. Go to the Site Settings page of the new site and select Go to Top-Level Site Settings. Then select Site Collection Features from the Site Collection Administration links.

  1. Click the Activate button for the Office SharePoint Server Enterprise Site Collection features. You may notice that the feature is already activated. If this is the case, then continue to next step without making a change.

  2. Return to the Site Settings page of your new communications site and select Site Features from the Site Administration links.

  3. Click the Activate button for the Office SharePoint Server Enterprise Site features.

image from book

Try It Out-Publish a Form Template to a Document Library

image from book

Now that your site is prepared to host the form template, you will publish it to a document library on the site as part of the form publishing process. This is the first of three publishing options available in InfoPath for publishing to a SharePoint Server and is the least complex. The other more advanced options are explored in the last section of this chapter.

Publishing a form template to a document library is most appropriate if you only have to make the form available in a single location and have no need to associate the form with a content type or multiple sites.

  1. Open the InfoPath application.

  2. From the Getting Started window, select Design a Form Template.

  3. Select On My Computer from the Open a Form Template group. Browse to the location where you saved the employeefeedback.xsn template from a previous example and click Open. Alternatively, the form may be listed in the Recent Form Template section.

  4. From the Design Tasks pane, select Publish Form Template.

  5. A wizard appears asking where you want to publish the form. Select To a SharePoint Server with or without InfoPath Forms Services.

  6. Click the Next button.

  7. Enter the URL of the communications site you created in the previous Try It Out.

  8. Click the Next button.

  9. Select the check box to Enable This Form to Be Filled Out by Using a Browser, as shown in Figure 10-31.

    image from book
    Figure 10-31

  10. Keep the default selection of Document Library for what you want to create or modify.

  11. Click the Next button.

  12. Keep the default selection to Create a New Document Library and click the Next button.

  13. Enter Feedback Form for the name of the library.

  14. For Description, enter the following:

    Important 

    Electronic form for collecting feedback from employees on new communications website.

  1. Click the Next button.

  2. Click the Add button and add each of the fields contained in the form so that they can be promoted to columns in the library. You will have to repeat the process for each field.

  3. Click the Next button.

  4. Click the Publish button.

  5. Once your form is published to the document library, you can click the Open This Form in the Browser link to view the form in its published state.

How It Works

In this example, you created a new document library on the communications sites as part of the form publishing process. This document library has the form template associated with it so that whenever a user enters the site and clicks the New button, the form is launched. If the user has InfoPath on his computer system, the form opens in the application. If the user does not have the application installed, it is launched from in the browser.

During the publishing process, you chose to promote specific fields within your form template to become columns within your document library. This allows you to see the contents of the forms in a view in the library without having to open each form individually. This makes it possible to create custom reports on data stored within a document library.

image from book

Try It Out-Force a Form to Open as a Web Page

image from book

In this next exercise, you will review how you can change the setting on the document library to enforce everyone to open the form within a browser. In some situations, this technique will be used to ensure that all users have a consistent experience when completing forms. It also helps control the interface so that only items exposed within a specific view are displayed to the user.

  1. From the main page of your communications site, click the View All Site Content link.

  2. Click the Feedback Form link to enter the document library.

  3. Select Settings image from book Form Library Settings from the Library toolbar.

  4. Click the Advanced Settings link.

  5. For the Opening Browser-Enabled Documents value, select Display as a Web Page, as shown in Figure 10-32.

    image from book
    Figure 10-32

  6. Click the OK button.

  7. Return to the document library by clicking the Feedback Form link in the breadcrumb trail.

  8. Click the New button from the Document Library toolbar.

How It Works

As previously described, in some situations it may be necessary to ensure that all users open a form as a web page regardless of whether they have the InfoPath application installed. In this exercise, you modified the properties of the document library to ensure that all browser-enabled documents, including InfoPath forms, are opened in the browser.

Now that you have published your form template to the site, users can come in and complete the form template. When they are done, they can save the form back to the library using the toolbar buttons. However, after giving it some consideration, you have decided that it would be nice to have a Submit button added to the form that will save the document back to the library and name it automatically. This is the subject of the next section.

image from book

Customizing a Form Template

Once a template has been created and published to a library, it can still be edited and enhanced to further address business needs. As a form designer, you should consult with business users to identify ways in which the form can evolve to better suit their needs. This may include improving how data is submitted or saved to a library as well as how the form is presented to users.

In this section, you are going to review some of the enhancements and changes you can make to a form template that might make it a more effective tool for a team. In the first Try It Out, you look at how you can add a button to a form as well as submit a data connection that will save the form to a destination library without requiring a user to select Save As from the File menu. These approaches helps ensure that a proper naming scheme is followed for saved forms because the name can be derived from form data upon submission. It also makes the user experience better for those completing the form because they do not have to bother with understanding the details of where and how they should save the form. Once you add a Submit button, there may no longer be a need to expose the Save buttons on the form’s toolbar to users. Therefore, in the second Try It Out of this section, you learn how the form’s toolbar can be customized to suit your needs. You then look at how a data connection can be added to a form template to retrieve information from another content source.

Try It Out-Add a Submit Button to a Form Template

image from book

In some cases, rather than having a user select File image from book Save As and manually name their form file, it’s more appropriate to offer a Submit button at the bottom of the form that the user can select when she completes the form. This makes the submission process easier because the user does not have to be concerned with where the file is being saved and what the file name will be.

In this exercise, you edit the Employee Feedback form to include a Submit button that will save the file to your library and automatically generate a name based on information stored within the form.

  1. Open the employeefeedback.xsn template in Design mode from the location saved to your computer.

  2. Select the bottom row of the table containing the form’s fields.

  3. Select Insert image from book Rows Below from the Table menu, as shown in Figure 10-33.

    image from book
    Figure 10-33

  4. From the Design Tasks pane, select the Controls.

  5. Click in the new row you created, and then select the button control from the Controls task pane.

  6. Select the button and click the right mouse button. Select the Button Properties item from menu. The button properties dialog box appears.

  7. Select Submit from the Action drop-down list.

  1. Click the Submit Options button.

  2. Select the check box to Allow Users to Submit This Form.

  3. From the Destination drop-down list, select SharePoint Document Library.

  4. Click the Add button to identify what document library you want users to submit to.

  5. Enter the URL for the document library you created for feedback forms. If you are unsure of the exact URL, visit the document library and copy the URL.

  6. For the File Name field, click the fx button to the right of the field.

  7. Enter the following into the Formula field as shown in Figure 10-34:

    Important 

    concat(employeeName, “ - “, now())

    image from book
    Figure 10-34

Tip 

Rather than typing employeeName, you should try clicking the Insert Field or Group button and select the field from the list. This is the optimal method for selecting fields from your form or a data source. Also ensure that you include the commas and quotation marks when entering your formula or you may receive an error.

  1. Click the OK button.

  2. Select the check box to Allow Overwrite if File Exists, as shown in Figure 10-35.

    image from book
    Figure 10-35

  3. Click the Next button.

  4. Click the Finish button.

  5. Unselect the option to have the submit option displayed on the toolbar and menu.

  6. Click the Advanced button.

  7. Change the drop-down list value for After Submit to be Close the Form.

  8. Click the OK button.

  9. Click the Apply button.

  10. Click the OK button.

  11. Click the Save button from the File menu to ensure that your changes are saved.

How It Works

In this example, you made a modification to the form template to allow users to more easily submit their changes to the document library. Previously you had to rely on users to click the Save As button from the toolbar or menu. From that point, users were required to name the file on their own. This could lead to major inconsistencies in naming practices and the ability to easily identify specific differences between forms.

You implemented a Submit button on the form. You could use several different methods to submit the form, including Web Services or email. However, in this situation, because all completed forms are being saved to the same document library you are using to launch the form, it makes sense to use the Submit to Document Library option.

In addition to specifying where you can submit a form, you can select how the form should be named, whether items with the same name should be overwritten, along with what actions take place once the form is submitted. In this situation, you chose to name the forms based on the name of the employee submitting the form in addition to a special set of characters, which define the exact time the form was submitted. While this does not create a visually appealing file name, you can be sure that it will be very easy to identify who submitted each form, and you can ensure that file names will be unique. You also determined that if a file was updated and resubmitted, then the existing form record should be overwritten rather than creating a completely new record.

Your final customization choice when defining the Submit option was that you set the form to close upon submission. Given the type of form created, this sort of action seems most appropriate.

image from book

Try It Out-Customize the Forms Services Toolbar

image from book

Typically once such an update is made to a local copy of the form template, the changes should be immediately published to the SharePoint document library again. However, there is still another set of changes that need to be made to the form to make it more usable and intuitive. Figure 10-36 shows what the form looks like in its current form.

image from book
Figure 10-36

The users now have to choose between the custom Submit button, a Save button, and a Save As button. This can lead to some users selecting to save their forms using their own naming structure, and thereby eliminates any benefits associated with a standardized naming scheme that has been introduced with the custom button. Most important, for a very simple form you are offering users far too many choices. This leads to confusion and possibly even frustration. So in this example, you customize the toolbar that is automatically added to the Forms Services forms to only display the Print View option because this is something that users might find useful. In addition, because your form is fairly simple and small in size, you will remove the Footer toolbar because you don’t need it in this form.

  1. Return to your local copy of the Employee Feedback template featuring the changes implemented in the previous example.

  2. Select Form Options from the Tools menu.

  3. Unselect the option to display the toolbar at the bottom of the form.

  4. Unselect all commands except Print View, as shown in Figure 10-37.

    image from book
    Figure 10-37

  5. Click the OK button.

  6. Publish the latest version of your form to the SharePoint site using the methods described earlier in this chapter.

How It Works

In this example, you used the Form Options menu to customize what commands display in a toolbar to users when they view the form via the browser. You did this to simplify the interface so that users can easily identify what they should select when it comes time for them to submit their information to the site. As in most cases, it is far more important for users to focus on the information they are submitting rather than the steps they are taking to submit it.

image from book

Try It Out-Add a Data Connection to a Form Template

image from book

So far, you have reviewed how to create a custom template that supports browser-based viewing and editing. You created a data connection in the form template to allow for the form to be submitted to the document library using a standardized naming scheme. However, you can also use data connections to display information in a form from an external data source, such as a database, web service, or SharePoint site.

In the next example, you discover how data entry can be made easier by allowing information to be pulled directly from a central source. For this example you will use the user information list from your site collection. If for some reason you are unable to query that list, you can create a custom list on your site containing a field for Employee Name and Work Email Address and use that list as a data source.

  1. Return to your local copy of the Employee Feedback template featuring the changes implemented in the previous example.

  2. Select the employeeName field from the form’s Design view and click the right mouse button.

  3. Select Change To, and then Drop-Down List Box. The field is transformed into a drop-down list box.

  4. Double-click on the field to display its properties. The properties window appears.

  5. From the List Box Entries section, select the Look Up Values from an External Data Source option, as shown in Figure 10-38.

    image from book
    Figure 10-38

  1. Click the Add button to launch the Data Connection Creation Wizard.

  2. Select the Create a New Connection To option button, and select Receive Data.

  3. Click the Next button.

  4. Select SharePoint List or Library, and click the Next button.

  5. Enter the URL of the top-level site of your site collection. A listing of all lists in that site are returned.

  6. Select the User Information list.

  7. Click the Next button.

  8. Select the Name and Work Email fields, and click the Next button.

  9. Select the check box to store a copy of the data in the form template.

  10. Click the Next button.

  11. Retain the default settings for the data connection name and synchronization settings, as shown in Figure 10-39.

    image from book
    Figure 10-39

  12. Click the Finish button.

  13. Click the button to the right of the Entries field.

  14. Expand the groups and select the Name field, as shown in Figure 10-40.

    image from book
    Figure 10-40

  15. Click the OK button.

  16. Click the Apply, and then OK button.

  17. Double-click the employeeEmail field to manage its properties.

  1. Click the fx button to the right of the Default Value field.

  2. Click the Insert Field or Group button.

  3. From the Data Source drop-down list, select User Information List (Secondary), as shown in Figure 10-41.

    image from book
    Figure 10-41

  1. Expand the Data Fields group along with user_information_list group to view available fields.

  2. Select the work_e-mail field.

  3. Click the Filter Data button.

  4. Click the Add button to create a new rule for the filtering.

  5. Select Name for the left-hand drop-down list.

  6. For the right-hand drop-down list, select Use a Field or Group.

  7. Change the data source back to Main and select employeeName, as shown in Figure 10-42.

    image from book
    Figure 10-42

  8. Click the OK button on all open windows to commit changes.

  9. Click the Save button from the toolbar to ensure that your changes are committed to the template.

How It Works

When you first created your feedback form, you allowed users to enter whatever they wanted into the User Name field. As a result, you had mixed results because sometimes users would enter their first name and not their last, or enter their employee user ID, or, in a rush, would make a typo or misspell their name. This makes reporting on the data difficult. Instead of allowing users to enter their name in a text box, you decided to let them select their name from a drop-down list of choices. In addition, rather than manually maintaining this list of users, you would draw the value list from an external data source. In this case, it made sense to look up the users who were members of the communications site because these were the users you would be collecting information from directly.

In addition to a requirement to standardize the data that was being entered for name, you recognized a need to reduce and simplify the data entry experience of users as they were completing the form. For example, it seemed somewhat ridiculous to some users to specify their email address because they were logged in to the network as registered users. Therefore, the organization should already have an email address associated with them. You did not want to just strictly remove the field because your goal might be to later email all users who complete the form. Therefore, you decided that it would be useful to retain the Email Address field but have its value auto-populated based on the selection of a user’s name.

You therefore added a new data connection to the form template that looked up the user information list of the site collection. You specified that the information contained in this list should be available within the form itself. This allows you to open and interact with the external data when you are offline or detached from the network. A cached local copy of the data will be available to users while they are offline. From the data connection you selected the name and work email fields to be added to the form’s secondary data source.

Once the data connection was configured, you connected the drop-down list box to the data connection. By default, all names are returned and displayed in the drop-down list box. If required, additional filtering can be applied to display only a certain subset of users. You then configured the default value of your email address to be the email address specified for the user on the team site who had the same name as the value selected for employeeName within the form.

When you click the Preview button after making the changes, you should see the names of users from your communications site displayed in the drop-down list box. As you select a user, you should see that user’s email address appear in the Email Address field of the form. If you do not, the user may not have a specified email address within her SharePoint user profile.

Once you finish your updates, it will be necessary to publish these changes to the SharePoint Server again to update the template associated with the library.

image from book

Advanced Form Publishing Options

In the section “Publishing a Form Template to a Library,” you learned how a form template is published to a single document library. This approach is suitable for scenarios where a form is only required in a single location and where multiple groups or sites do not reuse the form. However, you may need to make a form template available to multiple sites in a site collection or multiple site collections. In each of these cases you can choose one of the advanced form publishing options.

For scenarios where you want to publish a form template to multiple sites or libraries in the same site collection, the optimal publishing choice is to publish as a Content Type. In Chapter 6, you learned how content types can be associated with multiple libraries and locations in a single site collection. In Chapter 7, you discovered how Web Parts, such as the Content Query Web Part, can be used to display rollups of content from multiple locations based on a single content type. So in the case of a feedback form that is deployed to multiple sites, you can add a single Web Part to a page that displays all instances of the form across all sites in a site collection. In the first Try It Out of this section, you publish your employee feedback form template to be a content type so that it can be added to multiple libraries. Because the data connection is added to submit your form to a central location, you do not have to worry about users saving the form data in multiple locations.

In some situations, you may have a single form template that you want to make available in multiple site collections. In this case, you would choose to upload your template as an Administrator-Approved form template via the Central Administration site. From there, form templates can be activated to site collections from one central location. This method is also the only supported choice for advanced form templates containing custom code or highly complex data connections. In the second Try it Out of this section, you walk through the process of uploading a form template to the Central Administration site and activating it out to a site collection.

Try It Out-Publish a Form Template as a Content Type

image from book

You now know how to publish a form template directly to a SharePoint document library. The next step to look at is the process for creating a content type by publishing a form template. For this example, you use the same form created in the previous section for Feedback. However, you open it in Design view and choose a different publishing location and type. You will publish the form template as a content type so that you can deploy it to multiple sites in the site collection.

  1. Open the Feedback Form template in Design mode from the local version you saved on your computer.

  2. From the Design Tasks pane, select Publish Form Template.

  3. Select To a SharePoint Server, with or without InfoPath Forms Services as the destination type.

  4. Click the Next button.

  5. Enter the URL of your Corporate Intranet portal (such as http://servername).

  6. Select the check box to Enable This Form to Be Filled Out by Using a Browser.

  7. Select Site Content Type (Advanced).

  8. Click the Next button.

  9. Select the Create a New Content Type option, as shown in Figure 10-43.

    image from book
    Figure 10-43

  10. Click the Next button.

  11. For the name of the content type, specify Employee Feedback Forms and enter the following for the description:

    Important 

    This content type is an electronic form for collecting feedback from employees on various communication methods and promotions. All content submitted using this content type will be directed to the communications site.

  1. Click the Next button.

  2. Click the Browse button to specify a location where the form template can be stored within the site collection.

  3. Select the Form Templates document library and click the Open button.

  4. Enter the name in the File name field as employeefeedback.xsn.

  5. Click the Save button.

  6. Click the Next button.

  7. Verify that the appropriate fields have been selected to be promoted as columns to document libraries within the site collection, and click the Next button.

  8. Click the Publish button. You receive a confirmation indicating that the form template was successfully published.

  9. Click the Close button to complete the wizard.

How It Works

After reviewing the number of responses you receive from the feedback form, you notice that not enough people were coming to the site to complete the form. Therefore, you decide it makes more sense to push the form template out to other sites in the site collection because quite often users are more inclined to complete a form from their own workspace rather than take the time to visit other workspaces. One of the primary advantages of a content type is being able to add a single content type to multiple locations throughout a site collection. Using the previously explored method of publishing directly to a document library, the form template could only be pushed out and associated with a single library. There would be no way to add it to other libraries without republishing it manually in a series of redundant and unrelated processes. Because the submit and receive data connections are still associated with the form, even if the template is added to a document library in another site, completed forms will still be submitted directly to the specified document library on the communications team site.

To add the InfoPath content type to a document library on other sites, you use the same process as was explored in Chapter 4. Similarly, you can apply all the same features available to content types to this form template including the association of workflow processes, information policies, as well as additional site columns.

image from book

Try It Out-Publish a Form Template as an Administrator-Approved Template

image from book

You may have a single form template that you are required to share with users across multiple site collections or a form template that was created using advanced development techniques and custom code. For each of these situations, you are required to use the Administrator-Approved Upload technique as described in this example. The example shows how to publish a form template to an administrative area of the portal so that it can be activated and published out to multiple site collections. You typically use this method for more complex forms that contain custom code, advanced functionality, or must be created as content types across more than one site collection. In this example, you use one of the sample forms available with InfoPath to keep things simple, but recognize that this is the method most commonly used for custom-developed complex forms.

  1. Open the InfoPath application.

  1. From the Getting Started window, select Customize a Sample from the Design a Form action group.

  2. Select the Sample – Expense report template.

  3. From the Form Tasks action list, select Design This Form.

  4. Select Publish Form Template from the Design Tasks pane. A window may appear advising you to save the form template. If you do, click OK to continue.

  5. Save the file locally to the folder containing all resource files for this chapter. Name the file expenseformtemplate.xsn. Once you save the form, the publishing wizard window appears.

  6. Select To a SharePoint Server with or without InfoPath Forms Services as the destination type.

  7. Click the Next button.

  8. Enter the URL of your Corporate Intranet portal.

  9. Click the Next button.

  10. Select the Administrator-Approved Form Template (Advanced) option, as shown in Figure 10-44.

    image from book
    Figure 10-44

  11. Click the Next button.

  12. You are now required to save the file to a location from where an administrator can upload it. Typically you would place the form template on the server or in a network location both you and the administrator have access to. Save a copy of the form template to the Chapter Resources folder using the name ExpenseForm.xsn.

  13. Click the Next button.

  14. Select any fields from the form that you want displayed in document libraries as columns and click the Next button.

  15. Click the Publish button. You receive a confirmation indicating that the form template was successfully published.

  1. Click the Close button to complete the wizard.

  2. Go to the Central Administration site for your SharePoint Server.

  3. Select the Application Management tab.

  4. Click the Upload Form Template link from the InfoPath Forms Services group, as shown in Figure 10-45. The form upload window appears.

    image from book
    Figure 10-45

  5. Browse to the location where you saved the ExpenseForm.xsn template in step 13. Select the form and click Open. You are returned to the form upload window.

  6. Click the Upload button. You receive a success message.

  7. Click the OK button.

  8. The final step in this process is to activate the form template out to a site collection. Hover your cursor over the form’s name in the list of form templates and select Activate to Site Collection from the drop-down menu as shown in Figure 10-46.

    image from book
    Figure 10-46

  9. Select your Corporate Intranet site collection as the Activation Location. You may need to change the default value to do this.

  10. Click the OK button.

How It Works

In this exercise, to publish the form template, you first have to save it locally as is required for publishing all form templates. Next, you define where you want to publish the template. You then had to save the form a second time. The most common reason for this second save is that in many organizations, the person creating the form is not necessarily the person with the rights to perform the upload operation. Instead, they will save the form template to a shared location on the network where a server farm administrator can access the form and complete the operation.

Once you complete the Publishing Wizard, the form is prepped for upload. However, the upload has to take place from the SharePoint Central Administration site. From there, the form template is uploaded from the shared location. Once it is uploaded, it was then activated out to the site collections where you intend to use the form. The activation process creates a content type within the site collection using the Microsoft Office InfoPath group name.

image from book




Beginning SharePoint 2007. Building Team Solutions with MOSS 2007
Beginning SharePoint 2007: Building Team Solutions with MOSS 2007 (Programmer to Programmer)
ISBN: 0470124490
EAN: 2147483647
Year: 2007
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net