Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

 
 
Microsoft Office InfoPath
Search
Search
 
Icon: Flag: (c) Microsoft
Get up to speed
 
 
 
Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Make a control required
 

If you want to require users to enter a value into a control (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) when they fill out your form, you must make the field that the control is bound (bind: To connect a control to a field or group in the data source so that data entered into the control is saved. When a control is unbound, it is not connected to a field or group, and so data entered into the control will not be saved.) to a required field. For example, to help ensure that a user selects a check box to indicate compliance with a user agreement, you can make the field associated with the check box a required field.

Depending on the procedure that you use to make a control required, and whether a user fills out a form based on your form template by using a Web browser, a required control may be displayed in one of the following ways:

In this article


Compatibility considerations

When you design a form template in InfoPath, you can choose a specific compatibility mode to design a browser-compatible form template. When a browser-compatible form template is published to a server running InfoPath Forms Services, and then browser-enabled, forms based on the form template can be viewed in a Web browser. When you design a browser-compatible form template, some controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser.

Some data validation features work differently in a Web browser than they do in InfoPath. For example, when you add data validation to a control, you create explanatory text to be displayed when a user enters invalid data into that control. You can have this explanatory text appear in a ScreenTip, and optionally allow users to display an alert that contains additional information, or you can have the alert appear automatically when a user enters invalid data. Alerts cannot be displayed automatically for forms that are viewed in a Web browser, but users can still view the ScreenTip, and optionally display an alert containing additional information.

ShowList of controls that can be set as required fields

The following table lists the Microsoft Office InfoPath 2007 controls that can be set as required, and indicates whether each control is available for browser-compatible form templates.

Controls that support data validationAvailable for browser-compatible form templates?
Check boxYes
Date pickerYes
Drop-down list boxYes
List boxYes
Option buttonYes
Text boxYes
Rich text boxYes
Bulleted, numbered, or plain listNo
Combo boxNo

 Note   Most controls that support being set as required have a Cannot be blank check box in the Control Properties dialog box. By selecting this check box, you make the field associated with that control a required field. However, the Rich Text Box Properties dialog box does not have a Cannot be blank check box, so you must create a custom error message for it by following the procedure "Display a custom error message when a control is left blank" later in this article.

Top of Page Top of Page

Display a standard error message when a control is left blank

Most controls that support being set as required have a Cannot be blank check box in the Control Properties dialog box. By selecting this check box, you make the field for the control a required field.

 Note   If you are unable to select the Cannot be blank check box, or if the check box does not appear, you must create a custom error message.

  1. Click the control that you want to make required.
  2. On the Format menu, click Control Properties.
  3. Click the Data tab.
  4. Under Validation and Rules, select the Cannot be blank check box.

Top of Page Top of Page

Display a custom error message when a control is left blank

  1. Click the control that you want to display a custom error message for.
  2. On the Format menu, click Data Validation.
  3. Click Add.
  4. In the first box under If this condition is true, click Select a field or group, and then select the field or group that the control is bound to.
  5. In the second box, click is blank.
  6. To automatically show a dialog box message when a user leaves a control blank, select the Show dialog box messages immediately when users enter invalid data check box.

     Note   Because dialog box messages cannot be displayed automatically in a Web browser, a user who fills out your form by using a Web browser will see only the ScreenTip.

  7. In the ScreenTip box, type the text that you want to display when a user points to the control or right-clicks the control.
  8. In the Message box, type the text that you want to display in the dialog box either immediately or when the user requests more details.

     Note   The ScreenTip for a data validation error will not display for controls that also have a default ScreenTip set on the Advanced tab of the Control Properties dialog box. This behavior helps to ensure that the name of the control is accurately conveyed to users who are using screen readers.

Top of Page Top of Page

advertisement