Lab 2: Designing a Form in InfoPath 2003

 

Microsoft Corporation

April 2004

Applies to:
    Microsoft® Office InfoPath™ 2003

Summary: Learn how to lay out, add controls, and add a color scheme to a simple sales form. In addition, learn how to select print settings and preview the form. (6 printed pages)

Contents

Scenario
Lab Objective
Exercises

Download the odc_INF03_Labs.exe sample file.

Scenario

Each month, sales representatives from Contoso Corporation go to various countries or regions around the world to sell Contoso products to customers. At the end of each month, Contoso's management team wishes to receive a form listing all of the sales in a given country or region.

Lab Objective

In this lab, you learn how to do the following:

  • Lay out a simple sales form.
  • Add controls to the form.
  • Add a color scheme to the form.
  • Select printing settings for the form.
  • Preview the finished form.

Exercises

Exercise 1: Specify Form Layout Options

When designing an InfoPath form, you can use layout tables to help you arrange controls and text in your form. This exercise demonstrates how to add several layout tables to your form.

Before you can begin adding layout tables, you need to create a new form.

To create a blank form

  1. Start InfoPath.
  2. In the Fill Out a Form dialog box, click Design a Form.
  3. In the Design a Form task pane, click New Blank Form. After creating your form, you can insert a title that describes the form's purpose.

To insert a title

  1. In the Design Tasks task pane, click Layout.
  2. In the Insert layout tables list in the Layout task pane, click Table with Title.
  3. In the form, click the Click to add a title placeholder text, and then type Contoso Sales Report.
  4. Select the title text, and then, on the Standard toolbar, click Bold. Now that you have added a title to your form, you are ready to create your form's layout.

To insert a layout table

  1. Move your insertion point underneath the table containing the form title, and then press ENTER.

  2. On the Standard toolbar, click Insert Layout Table.

  3. Use the expanded menu to choose a 2 rows x 3 columns Table.

    At this point, your form should look like this:

    Click here for larger image.

    Figure 1. Table with layout (Click picture to view larger image)

Exercise 2: Insert Controls

When filling out forms, users enter information by typing in text boxes, clicking items in lists, selecting check boxes, and performing other actions. The objects that users interact with are called controls. This exercise demonstrates how to insert controls into your form.

Before you begin adding controls to your form, you want to add labels for the controls.

To add labels to controls

  1. With the form from Exercise 1 still open, place your insertion point in the first cell at the top of the table, type Sales Representative:, and then press ENTER.

  2. Type additional labels and adjust column widths in the layout table so that your form looks this:

    Click here for larger image.

    Figure 2. Table with labels added (Click picture to view larger image)

Now that you have added labels, you are ready to insert controls in the form.

To insert controls

  1. At the top of the Layout task pane, click Controls.

  2. From the Insert controls list in the Controls task pane, drag a Text Box control onto the form under the Sales Representative label.

  3. From the Insert controls list, drag the Drop-Down List Box control onto the form under the Period label.

  4. In the form, double-click the drop-down list box you just inserted.

  5. Under List box entries in the Drop-Down List Box Properties dialog box, click Add.

  6. In the Value box in the Add Choice dialog box, type January 2004, and then click OK. Repeat this step to add entries for February 2004 and March 2004 so that the List Box Properties dialog box looks like this:

    Figure 3. List Box Properties dialog box

  7. From the Insert controls list in the Controls dialog box, drag the Text Box control onto the form under the E-mail Address label.

  8. From the Insert controls list, drag the Drop-Down List Box control onto the form under the Department label.

    Note   For this lab, we leave the Department drop-down list box empty.

Your form should now look like this:

Click here for larger image.

Figure 4. Form with controls (Click picture to view larger image)

Exercise 3: Add Repeating Controls

Contoso sales representatives typically visit many customers in a given month. In the next exercise, you add a repeating "customer name" section to the form to collect customer data. Sales representatives can insert as many of these sections as they need into their sales report forms.

To insert a repeating section

  1. With the form from Exercise 2 still open, drag a Repeating Section control from the Controls task pane onto the form, just under the second layout table.
  2. Click inside the repeating section, and then type Customer Name:.
  3. From the Insert controls list in the Controls task pane, drag the Text Box control onto the form next to the Customer Name label.
  4. To change the width of the text box, double-click it, and then, in the Text Box Properties dialog box, click the Size tab.
  5. Under Size, in the Width box, type 300. Leave px as the unit of measurement.

Customers often purchase multiple products from Contoso sales representatives. If you include a repeating table inside the repeating section, sales representatives can record the details about each product they've sold to a customer.

To insert a repeating table

  1. From the Insert controls list in the Controls dialog box, drag a Repeating Table control onto the form under the Customer Name box.
  2. In the Number of columns box in the Insert Repeating Table dialog box, click 4, and then click OK.
  3. Above each cell in the table you inserted, type Name, Price, Units Sold, and Total for the column titles.

Your form should now look like this:

Click here for larger image.

Figure 5. Form with repeating table (Click picture to view larger image)

Exercise 4: Insert Optional Sections

Customers occasionally ask Contoso sales representatives to handle their order in a customized fashion. To record these special requests, or to record other supplementary notes about the customer, you can create an optional "Notes" section in the sales report form. This section won't appear unless the person filling out the form chooses to add it.

To insert an optional section

  1. With the form from Exercise 3 still open, click More Controls on the Insert menu.
  2. From the Insert controls list in the Controls task pane, drag the Optional Section control onto the form under the repeating table but inside the repeating section.
  3. To add a label to the optional section, click inside the optional section, and then type Notes:.
  4. From the Insert controls list in the Controls task pane, drag the Rich Text Box control onto the form under the Notes: label. You use this rich text box to store notes about each customer.

Your form should now look like this:

Click here for larger image.

Figure 6. Form with optional section (Click picture to view larger image)

Exercise 5: Apply a Color Scheme

The form that you have created looks pretty plain. You can apply a color scheme to the form to make it look more interesting.

To apply a color scheme

  1. On the Format menu, click Color Schemes.
  2. In the Apply a color scheme list in the Color Schemes task pane, click Burgundy.

Your form should now look like this:

Click here for larger image.

Figure 7. Form with color scheme (Click picture to view larger image)

Contoso sales representatives often print copies of their form before submitting them to management. Therefore, you should consider how your form will look when it is printed. In the following exercises, you learn how to add footers and page breaks to your form.

  1. On the View menu, click Header and Footer.

  2. On the Print Settings tab in the View Properties dialog box, click Footer.

  3. In the Print form with this footer text box in the Footer Format dialog box, type Contoso Confidential. Page.

  4. In the Insert Auto Text list, click Current Page.

    The text in the Print form with this footer text box should look like this:

    Contoso Confidential. Page &p
    

If you want data about each customer to print on a separate page, you can add a page break after the repeating "customer name" section.

To insert a page break

  1. In the form, place your insertion point underneath the repeating section.

  2. On the Insert menu, click Page Break.

    In design mode, a page break appears as a dashed line in the form area. If you preview your form, you won't see this dashed line or any other indication of the page break. To see how the page break affects your form when it's printed, click Print Preview on the Standard toolbar.

Exercise 7: Preview the Form

Before publishing the sales report form, you can test its functionality and appearance in a special preview window. Previewing and testing your form allows you to see and work with the form from your user's perspective.

To preview the form

  1. On the Standard toolbar, click Preview Form.

    The form opens in a new window.

  2. To test the controls in the form, do the following:

    • To add a row to the repeating table, place your cursor inside the table, and then press CTRL+ENTER.
    • To insert a new "customer name" section, click Insert item at the bottom of the form.
    • To insert the optional "Notes" section, click Click here to insert.