<< Click to Display Table of Contents >> FormField (object) |
Access paths:
▪Application à Documents à Item à FormFields à Item
▪Application à ActiveDocument à FormFields à Item
1 Description
A FormField object represents one individual form object of a document and allows you to retrieve the value it returns or to change its formatting.
Each form object can represent either a text field, a check box or a drop-down list.
An individual FormField object exists for each form object. If you add form objects to a document or delete them, the respective FormField objects will be created or deleted dynamically.
2 Access to the object
The individual FormField objects can be accessed solely through enumerating the elements of the collection FormFields. Each document has exactly one instance of this collection.
An example:
' Show the name of the first form object in the document
MsgBox tm.ActiveDocument.FormFields(1).Name
Text fields, check boxes and drop-down lists have common properties as well as type-specific ones. Accessing these properties can be performed in different ways:
▪Properties that are available in all form objects (for example, whether they are visible) can be found directly in the FormField object. Details on these properties will follow below.
▪Properties that are type-specific (for example, only selection lists possess a list of all their elements) can be found in the TextInput, CheckBox and DropDown child objects. These properties are documented for each child object.
3 Properties, objects, collections and methods
Properties:
▪Name
▪Visible
▪Printable
▪Locked
▪Tabstop
▪Type R/O
▪Result R/O
Objects:
▪TextInput → TextInput
▪CheckBox → CheckBox
▪DropDown → DropDown
▪Application → Application
▪Parent → FormFields
Name (property)
Data type: String
Gets or sets the name of the object. Corresponds to the "Name" option on the Properties tab of the dialog box with the properties of an object.
Visible (property)
Data type: Boolean
Gets or sets the "Visible" setting of the object (True or False). Corresponds to the "Visible" option on the Properties tab of the dialog box with the properties of an object.
Printable (property)
Data type: Boolean
Gets or sets the "Printable" setting of the object (True or False). Corresponds to the "Printable" option on the Properties tab of the dialog box with the properties of an object.
Locked (property)
Data type: Boolean
Gets or sets the "Locked" setting of the object (True or False). Corresponds to the "Locked" option on the Properties tab of the dialog box with the properties of an object.
Tabstop (property)
Data type: Boolean
Gets or sets the setting whether the object has a tab stop (True or False). Corresponds to the "Tab stop" option on the Properties tab of the dialog box with the properties of an object.
Type (property, R/O)
Data type: Long (TmFieldType)
Returns the type of the object as a numeric value. The possible values are:
tmFieldFormTextInput = 1 ' Text field
tmFieldFormCheckBox = 10 ' Check box
tmFieldFormDropDown = 11 ' Drop-down list
Result (property, R/O)
Data type: String
Returns the current result of the object:
▪For CheckBox: the text of the checkbox if it is checked; otherwise an empty string
▪For DropDown: the entry selected at the moment (as text)
▪For TextInput: the content of the text field
TextInput (pointer to object)
Data type: Object
Returns the TextInput object that allows you to access the text field specific properties of the form object.
Note: The form object represents a text field or a text frame only if the property TextInput.Valid returns True.
CheckBox (pointer to object)
Data type: Object
Returns the CheckBox object that allows you to access the checkbox specific properties of the form object.
Note: The form object represents a checkbox only if the property CheckBox.Valid returns True.
DropDown (pointer to object)
Data type: Object
Returns the DropDown object that allows you to access the drop-down list specific properties of the form object.
Note: The form object represents a drop-down list only if the property DropDown.Valid returns True.
Application (pointer to object)
Data type: Object
Returns the Application object.
Parent (pointer to object)
Data type: Object
Returns the parent object, i.e. an object of the type FormFields.