Working with Fields

A field stores a value for a control. For example, the graphic displayed by an Image control is identified by the value of the field bound to the Image control. When you change the value of the field bound to this Image control, the graphic displayed changes wherever that control appears — such as on the read and compose versions of the page.

To assign an initial value to a field at design time, right-click the control to which the field is bound, and click Properties to display the Properties dialog box. Click the Value tab, and type the value in the text box under Initial Value. By clicking Edit, you can also specify a formula with which the initial value will be calculated, using other fields in the form as operands.

Using Custom Fields

To create a custom field for a control, first show the Properties dialog box for that control. Click the Value tab and then click New. This displays the New Field dialog box. Now type the name of the field and the data type with which it will be stored. This assignment allows some flexibility. For example, you can choose "Text" for an option button. This means that the value returned when the option button is clicked is a text string and not an integer.

Although it is possible to select an incorrect data type, choosing the correct type for your purpose is often obvious. If you need to work with string values, for instance, choose "Text." To work with a number, choose "Number"; for a check box, choose "Yes/No."

Creating a custom field for a control or set of controls can make it easier to identify and to work with, especially in the form's script. For example, in the EnhancedLitCrit form, the field that holds the Technical Level a user selects while reviewing an item is not a standard field but a custom field called Tech Level. It is a bound to the cmbTechnical control, a ComboBox. The script for EnhancedLitCrit uses the Tech Level field once, when the form is posted:

If UserProperties("Tech Level")= "<Select Rating>" Then
   UserProperties("Tech Level")="Not Rated"

In the preceding code, the value of the Tech Level field is checked, and if it has not changed from its initial value, it is set to "Not Rated." This string operation involves only the Tech Level text field, not the ComboBox control to which it is bound.