Make a control required

If you want to require users to enter a value into a control when they fill out your form, you must make the field that the control is bound 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:

  • As a standard error alert, which consists of a red asterisk or dashed red border and a ScreenTip that reads Cannot be blank.

  • As a custom error message, which displays in a dialog box.

In this article

Compatibility considerations

Display a standard error message when a control is left blank

Display a custom error message when a control is left blank

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.

List 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 validation

Available for browser-compatible form templates?

Check box

Yes

Date picker

Yes

Drop-down list box

Yes

List box

Yes

Option button

Yes

Text box

Yes

Rich text box

Yes

Bulleted, numbered, or plain list

No

Combo box

No

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

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

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

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×