Home > Articles

  • Print
  • + Share This
Like this article? We recommend

Building the Form

InfoPath in Design mode allows you to put together a form in just a few minutes. Like most forms, this one begins with an empty table. The instructions here are general and apply to any forms you might want to create, but I'll be developing that lunch menu as we go along, and I'll explain what I did to create the form that I show.

TIP

If you follow along through this exercise with InfoPath, remember to save frequently (because I'm not going to remind you). You might occasionally use the Preview option in the File menu to see how the finished form will look. Remember that you must close the preview before you can continue.

The first step in form building is to establish the layout by setting up a table to give structure to the form. Then you add labels to the cells. Here we go!

  1. Launch InfoPath.

  2. From the File menu, choose Design a Form. This action causes the Design task pane to appear on the right side of the InfoPath window.

  3. In the Design task pane, click New Blank Form and then click Layout.

  4. In Insert Layout Tables, click Table with Title and drag it onto the design area.

  5. Type a title in the top cell. For design purposes, I deleted the text under the title bar and left this cell empty.

  6. Place the cursor in the lower cell and click to add a row until you have the desired number of rows. I clicked three times.

  7. To divide a row into columns, put the cursor in the row, click Custom Split, specify the number of columns (I used 3), and make sure that the row number is 1.

  8. Type labels in your cells.

Figure 1 shows my results at this point.

Figure 1Figure 1

Now you're ready to add controls to the table structure. You have a whole cornucopia of controls at your disposal. To see them, click More Controls on the Insert menu.

NOTE

Make sure that the check box that says Automatically Create Data Source is checked. InfoPath will then create your data sources as you click-and-drag your controls.

The simplest and most frequently used of all form elements is the text box. These are the form spaces where people type name, position, address, medical condition, and so on. I started my luncheon form by providing a place for a name, to be sure I could match the person to his or her menu choices.

To add a text box, follow these steps:

  1. Place your cursor where you want the text box to appear, probably under the cell label.

  2. In the Controls list box, click Text Box.

  3. Double-click the right corner of the text box to show the text box properties.

  4. Change the field name to match the label in your cell. If your label contains more than one word, you'll need to eliminate the spaces or use just the first word.

  5. Choose a datatype (leave it set as Text for this exercise).

  6. You can click the Size tab and change the conformation of the text box, or you can wait until after you've closed the properties box and then just click-and-drag the text box into the shape you like.

  7. Click OK.

I added two text boxes in the form, one underneath the Name label and one underneath Allergies, and changed the sizing of the text boxes (see Figure 2).

Figure 2Figure 2

Option buttons are an excellent choice for the "pick one and only one option" categories. These are added as a group, and you specify the number of options for each group. Here's how:

  1. Place your cursor in the table cell where you want the buttons positioned. I put mine right under the Salad label because I wanted to offer three choices for salad.

  2. In the Controls task pane, click Option Button.

  3. Enter the number of buttons for this grouping and click OK.

  4. Double-click the first button to open the Option Button Properties dialog box.

  5. Type a field name. Note that this name is for the whole group of options, not just the first button. In this case, I called the field "Salad" to match the label name.

  6. Type a new value in the Value When Selecting field (I called this value "Caesar") and click OK.

  7. Double-click the default field name and change it to match the option you specified.

  8. Repeat as necessary for each option button.

As Figure 3 shows, I decided to use option buttons for the salad, main course, and dessert choices; but because there was a longer list of beverages, I selected a drop-down list for those.

Figure xxxFigure 3

And here are the steps to add that drop-down list:

  1. In the Controls task pane, click Drop-Down List Box and drag it into place.

  2. With your cursor on the drop-down arrow, right-click and select Drop-Down List Box Properties.

  3. Change the field name; here it's called "Beverage."

  4. Click Add and type the value for each option you want to offer.

  5. When you've added all the fields, click OK.

Many forms ask questions to which the correct answer can only be yes or no. The check boxes in Figure 4 fit this description.

Figure 4Figure 4

To add a check box to your form, follow these steps:

  1. In the Controls task pane, click a Check Box and drag it into place.

  2. Double-click the check box to show the Check Box Properties.

  3. Change the field name to match the label in your cell. If your label contains more than one word, eliminate the spaces or use just the first word.

  4. Click OK.

  • + Share This
  • 🔖 Save To Your Account