Working with Data Entry Controls


Controls for data entry are an integral part of an InfoPath form, so this section focuses on how to insert and modify these data entry controls on your forms. You have already had a brief look at how to do this in Chapter 4 when you created your very first form, but the following sections describe this process in further detail— the properties you are going to look at are common to most controls that are used for data entry. Once you have had a look at the generic properties that these controls share, you can then look at specific formatting attributes and features associated with each control.

Adding New Controls

When working with an InfoPath form, you can quickly add new controls to your form by dragging and dropping a particular control type from the Controls view of the Task Pane. All controls on an InfoPath form are bound to fields within your form. You can see these fields by selecting Data Source from the drop-down menu at the top of the Task Pane, as shown in Figure 6-1.


Figure 6-1: InfoPath data source

If you are creating a form to push data into an existing data source, an intermediary dialog box opens when you attempt to place one of these data entry controls onto your form. This dialog box, shown in Figure 6-2, is used to specify to which field your control is bound.

click to expand
Figure 6-2: A typical binding dialog box

In this example, a Text Box object is added to your form. When you submit this form to a database, the information entered into this object will be placed in the database field you have specified. This is one of the fundamental concepts of InfoPath—end users don’t need to know the underlying database structure or XML schema. All they see are the form controls, with meaningful labels indicating what data should be entered, and your form design takes care of the behind-the-scenes matching of the data they enter to your data source or XML file.

If you were creating a form from scratch, without having a back-end database or XML schema or file, you would be able to drag this Text Box object directly on your form without having to bind it to a particular field. This on-the-fly method that you used in Chapter 2 actually creates the data source as you go along. For example, if you were to drag a Text Box object onto a blank form, InfoPath would automatically create a field called Field1 in your data source.

Working with Control Size

After you have added a control to a form, you can quickly resize the control by using the “handles” that appear on each side of the control when you click to select it. By dragging these handles, you can control the height and width of the object. If you would like more precise control over the size and appearance of the control, you can also use the property pages associated with the control to set the height, width, and other formatting options.

To set these options, right-click the object, select Properties from the right-click menu, and then click to select the Size property page, which should look similar to the dialog box shown in Figure 6-3.

click to expand
Figure 6-3: Size property page

start sidebar
Did You Know?—About Padding and Margins

There are also two other measurements that you can set from this dialog box— the Padding and Margins settings. Padding refers to the buffer of space on the inside of the box, in between the perimeter of the object and the data that is entered. Increasing the Padding setting results in a white border that appears around the inside of your object, like the text box shown in the following illustration, where the Padding setting has been changed from 1 pixel to 10 pixels.

click to expand

Padding can be useful to add some white space to your form and evenly space the text boxes and text that appear on your form.

Margins refer to the buffer of space on the outside of the box, between the perimeter of the object and any other objects that may appear on your form. The form shown in the following illustration has had multiple Text Box objects added to the form, each with a margin setting of 20 pixels all the way around.

click to expand

end sidebar

By default, some objects (like Text Boxes) are set to an Auto height, where the height of the object is set in proportion to the text that is entered into the box. For example, if you enter five lines of text and have the wrapping option turned on, the height of the text box will be automatically stretched to five lines high. You can change this setting and the width of the field by entering a value in the field provided and selecting a unit of measure (cm, px, and so on).

Working with Advanced Properties

To set a number of unrelated options that are common to most objects, you use the Advanced property page, shown in Figure 6-4, as a “catch-all” for properties associated with a field that really didn’t fit anywhere else.

click to expand
Figure 6-4: Advanced properties

Screen Tips are used to display text when your mouse moves over a particular field—depending on applications that you may have used before, this may have been called Tool Tips or Bubble Help, but the concept is similar. You can use the Screen Tip text box to enter some text that will appear when the user moves her mouse near the field and holds it there for a few seconds.

The Tab Index setting, which is often overlooked, will be used often as you develop different forms. When creating a form, InfoPath sets the tab order based on the way the fields are arranged on your form—this means that when you open the form, the focus generally is given to the field that appears in the upper-left corner of your form, from which pressing the TAB key will take you through the different fields, moving from the left side of the page to the right.

You can change the tab order that is associated with a form by using the Tab Index setting provided in this dialog box—enter a value from 1 to the total number of fields, where 1 is the first field that will be selected when the form is opened. When the user presses the TAB key, this index is used to determine where the cursor goes next—if you don’t set the Tab Index for every field on your form, leaving the default of 0, InfoPath follows the index values it does have and then defaults back to the left-to-right method for moving through the form fields.

You can also use the Text Box Properties dialog box to set an access key for a particular Text Box object. For example, you could establish ALT-2 as the shortcut key for the Address2 field on a form by typing 2 in the Access Key field. Then, when the user presses ALT-2, they jump directly to this field on the form.

In either case, you will spend the majority of your time working with InfoPath when dealing with objects that capture data, and in the following sections, you will be looking at all the different types of objects that you can use for data entry, starting off with Text Boxes.




How to Do Everything with Microsoft Office InfoPath 2003
How to Do Everything with Microsoft Office InfoPath 2003 (How to Do Everything)
ISBN: 0072231270
EAN: 2147483647
Year: 2006
Pages: 142

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