Ways to customize a text box

After you insert a text box on a form template, you can customize it by accessing and changing its properties and settings in the Text Box Properties dialog box. To open the dialog box, on the form template, double-click the text box whose properties you want to change.

The following table describes some of the ways in which you can customize a text box and offers reasons why you might do so. Although the table doesn't provide detailed procedural information about the options in the Text Box Properties dialog box, it does give you an idea of the range of options that are available.

 Notes 

Tab Task Details
Data Change the associated field name

When you design a new, blank form template, you can change the default field or group name for a control to something that is easier to identify when you work with the data source. For example, a field named "Salesperson" is easier to understand than a field named "field1."

 Note   Changing the field name does not change the binding between a text box and field in the data source. If you need to bind a text box to a different field, right-click the text box, and then click Change Binding on the shortcut menu.

Data Change the data type

When you design a new, blank form template, you can change the default data type for a control. The default data type for a text box is Text (string), but you are free to change this. For example, if you want users to enter British pounds into a Transaction amount text box, you can choose the Whole Number (integer) data type, and then choose formatting options so that the values typed into the text box are displayed with the pound (£) currency symbol.

ShowMore about data types

The following table lists the data types that are available for text boxes.

Data type Description
Text (string) Use for data such as names, addresses, phone numbers, Social Security numbers, and so on.
Whole Number (integer) Use for positive or negative whole numbers, such as 1234, –1234, or $1,234.
Decimal (double) Use for numbers with decimal places, such as 1234.12, –1234.12, or $1234.12.
True/False (boolean) Use for data that should be either 1 (true) or 0 (false).
Hyperlink (anyURI) Use for hyperlinks, such as a Universal Naming Convention (UNC) (universal naming convention (UNC): A naming convention for files that provides a machine-independent means of locating the file. Rather than specifying a drive letter and path, a UNC name uses the syntax \\server\share\path\filename.) path or a Uniform Resource Locator (URL) (Uniform Resource Locator (URL): An address that specifies a protocol (such as HTTP or FTP) and a location of an object, document, World Wide Web page, or other destination on the Internet or an intranet, for example: http://www.microsoft.com/.).
Date (date) Use for dates, such as 3/14/2007 or March 14, 2007.
Time (time) Use for time-based values, such as 9:46:55 or 09:46 A.M.
Date and Time (dateTime) Use for both dates and times, such as 3/14/2007 11:30 A.M.
Data Specify a default value

If you want default text to appear inside a control when a user first opens the form, you can type that text in the Value box. You can also use the value of another field in the data source as the default value for a control. Default values are different from placeholder text (which is described later in this article) in that they are always saved as data in the form (.xml) file.

Data Display the results of a calculation To display the results of a calculation in a control, you can click Insert Formula Button image next to the Value box to associate formulas (formula: An XPath expression made up of values, fields or groups, functions, and operators. Formulas can be used to calculate mathematical values, display dates and times, and reference fields.) and functions (function: A predefined XPath expression that returns a value based on the results of a calculation.) with the control. For example, you can create a formula that sums a column of numbers in a repeating table by using a text box in conjunction with the sum function. Or you can associate the today function with a specific text box so that when the user opens the form, the current date is displayed in that text box.
Data Make the text box required To visually remind users to type data into a control, select the Cannot be blank check box. When users open the form, a red asterisk will appear in the control as a reminder not to leave it blank. Users cannot submit data until they enter a value in the control.
Data Add data validation

Click Data Validation to specify data validation rules for the control. For example, if you need part numbers to be entered in a specific format — three numbers, then a dash, and then two more numbers — you can use data validation to ensure that users conform to this pattern.

Data Apply rules When you click Rules, you can create a rule that makes one or more actions occur automatically when users change the value in a control. In a purchase order form, for example, if a user types a number greater than 10 in an Amount text box, you can use a rule to display a dialog box that says "Ordering more than 10 different items at once may delay shipping." You can also use a rule to automatically retrieve updated information from an external data source. For example, on a stock purchase form, you can use a rule to retrieve and display real-time stock quotes in a text box, either when the form is opened or when the user requests the information.
Display Display placeholder text

If you want to provide guidance to your users about what data to enter into the text box, you can type instructional text in the Placeholder box. For example, in a Number of nights in hotel text box, placeholder text can be used to prompt users on what type of data they should enter.

Like a default value, placeholder text appears inside a text-entry control when a user first opens a form. However, placeholder text is different from default values in the following three ways:

  • Placeholder text is never saved as data in the form (.xml) file.
  • Unlike a default value, which appears as regular text inside a control, placeholder text always appears dimmed.
  • Unlike a default value, placeholder text is not supported in browser-compatible form templates.
Display Make the text box read-only

To prevent users from changing the contents of a control, select the Read-only check box. For example, if you use a text box to display the results of a formula, you can make the text box read-only to prevent users from typing over that result. Although a read-only text box does not appear dimmed in the form, users will be prevented from typing information in the text box.

Display Turn off the spelling checker or AutoComplete feature To prevent users from checking the spelling of text inside a text-entry control or from automatically reusing previous entries that were typed into the form in that control, clear the Enable spelling checker and Enable AutoComplete check boxes, which are both selected by default. For example, you can disable the spelling checker for text boxes that display proper names. You can disable AutoComplete for privacy reasons, such as when a form will be shared among many people.
Display Let users type multiple lines of text If you want a text box to display more than one line of text, select the Multi-line check box. You can then decide whether to allow paragraph breaks inside the text box.
Display Enable paragraph breaks If you select the Multi-line check box, and you want users to be able to type paragraphs of information into the text box, select the Paragraph breaks check box. This is useful, for example, when you want users to answer an essay-like question in a text box, but you want the data to be in plain-text format because users will ultimately submit it to a database. If you select the Multi-line check box in a browser-compatible form template, you won't be able to clear the Paragraph breaks check box.
Display Enable text wrapping If you select the Multi-line check box, InfoPath automatically selects the Wrap text check box so that text will flow from one line to another as users type in the text box. When text wrapping is enabled, you can select scrolling options in the Scrolling list. For example, you can make scroll bars appear in the text box when users type more text than the text box can display by default. For scrolling options to work properly, your text box must be a fixed height and width. If you select the Multi-line check box in a browser-compatible form template, you won't be able to clear the Wrap text check box or specify options in the Scrolling list.
Display Limit characters To assign a character limit to a text box, select the Limit text box to check box, and then type the allowable number of characters. For example, in a human resources form template, you can use this feature to prevent users from typing more than five characters in an Employee ID text box. If your form template is connected to a database or to an external XML Schema (XML Schema: A formal specification, written in XML, that defines the structure of an XML document, including element names and rich data types, which elements can appear in combination, and which attributes are available for each element.), and that data source has existing character-length requirements, Microsoft Office InfoPath will automatically display a data validation error if users exceed these limits when they fill out a form based on your form template. To make the cursor advance automatically to the next control on the form after the user reaches the character limit for a control, select the Move to next control automatically when limit is reached check box. Making the cursor advance automatically to the next control is not supported in browser-compatible form templates.
Display Add conditional formatting

Click Conditional Formatting to open the Conditional Formatting dialog box, where you can change the appearance of a control, including its visibility, based on values that users enter into the form. For example, in a sales report form template, you can use conditional formatting to alert the user that the amount spent is greater than the amount budgeted.

Size Adjust size, padding, and margins

You can manually specify the size of a control by entering values in the Height and Width boxes. You can also refine the spacing both inside and outside the control by changing the padding, which is the amount of buffer space surrounding the control's contents, or the margins, which is the amount of space between the control's border and any surrounding text or controls on the form template.

Size Align the text box with its label

To better align the text inside of a control with its label, click the Align button. InfoPath automatically adjusts the control’s height, bottom padding, and bottom margin settings as necessary.

Advanced Specify a ScreenTip

To make an explanatory note appear when users move their pointer over the control, enter the text that you want in the ScreenTip box. Accessibility aids, such as screen review utilities that make on-screen information available as synthesized speech or a refreshable Braille display, often rely on these ScreenTips to interpret information for their users.

Advanced Change the tab index order

You can change the position of a control in the form template's overall tab order. Tab order is the order in which the focus moves in a form from one field or object to the next as users press TAB or SHIFT+TAB. The default tab index setting for all controls in a form template is 0, but the tab order starts with 1. That is, any control with 1 in the Tab index box will be visited first when users press the TAB key. Any control with 2 in the Tab index box will be visited second, and so on. Any controls with 0 in the Tab index box will come last in the tab order. If you want to skip controls in the tab order, enter -1 in the Tab index box.

Advanced Assign a keyboard shortcut

You can type a letter or number in the Access key box to specify a keyboard shortcut. Keyboard shortcuts enable users to navigate to a control by pressing a combination of keystrokes, rather than by moving the mouse. If you choose to use keyboard shortcuts in your form template, you must communicate to users that the shortcuts exist. For example, you might type (ALT+S) after a text box label to let users know that there's a keyboard shortcut for a Salesperson text box.

Advanced Specify or customize merge actions

Click Merge Settings to specify how data that users enter into the control should appear when several forms are combined. For example, you can choose to prefix the text from a text box with a particular word, or separate text box items with a semicolon.

Advanced Obtain the ViewContext identifier for the text box

You can use the ViewContext value to identify the control in code. For example, if you know the ViewContext value, you can use that value with the ExecuteAction method of the View object to programmatically perform an editing action on the XML data that is bound to the control.

Advanced Specify and customize an input scope

Click Input Scope to specify the type of user input that is intended for the control. This can help improve the recognition of handwriting and speech input for the control. For example, if you use the IS_URL input scope for the control, InfoPath knows to ignore spaces between words.

Browser forms Customize settings for posting data back to the server

The Browser forms tab appears only when you are designing a browser-compatible form template. It allows you to control whether data is sent to the server when users change data in the text box.

 
 
Applies to:
InfoPath 2007