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.
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!
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.
In the Design task pane, click New Blank Form and then click Layout.
In Insert Layout Tables, click Table with Title and drag it onto the design area.
Type a title in the top cell. For design purposes, I deleted the text under the title bar and left this cell empty.
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.
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.
Type labels in your cells.
Figure 1 shows my results at this point.
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.
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:
Place your cursor where you want the text box to appear, probably under the cell label.
In the Controls list box, click Text Box.
Double-click the right corner of the text box to show the text box properties.
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.
Choose a datatype (leave it set as Text for this exercise).
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.
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).
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:
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.
In the Controls task pane, click Option Button.
Enter the number of buttons for this grouping and click OK.
Double-click the first button to open the Option Button Properties dialog box.
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.
Type a new value in the Value When Selecting field (I called this value "Caesar") and click OK.
Double-click the default field name and change it to match the option you specified.
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.
And here are the steps to add that drop-down list:
In the Controls task pane, click Drop-Down List Box and drag it into place.
With your cursor on the drop-down arrow, right-click and select Drop-Down List Box Properties.
Change the field name; here it's called "Beverage."
Click Add and type the value for each option you want to offer.
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.
To add a check box to your form, follow these steps:
In the Controls task pane, click a Check Box and drag it into place.
Double-click the check box to show the Check Box Properties.
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.