How and When Is a Field Validated?

VPME Control Classes: When you place a field on a form using a control that is based on a VPM Enterprise control class, the field is automatically linked to the field validation rules that you specify for the field on the Integrity page in the Data Builder.

AdminTool_FieldValidation Method: When the focus is placed on a field on a form and then moved from the field, the VPME Application object's AdminTool_FieldValidation method is fired, which in turn runs the AdminTool_FieldValidation method of the active form and the field’s validation rules are applied. See the Application Class chapter in the VPM Enterprise Technical Reference manual to learn about the VPME Application class and object.

PreValidation Code: Before validation is run for a field, any "PreValidation Code" you have entered for the field is run. PreValidation Code is a VPME-provided feature in the Data Builder that allows you to enter code to prevent the value from being validated, determine the value to be returned by the validation routine and/or define a message to be displayed. See Field-Level Data-Driven Developer Code.

Error Message: If a field fails validation, the message defined in the field’s Data Builder Error property is displayed. If there is no entry in the Error property, “Invalid Input” is displayed.

Picklist Help: If a field uses the Referential or Set validation type, a picklist of valid entries can be displayed by pressing F2 or by right-clicking the field and selecting Picklist from a shortcut menu. A valid entry can be selected from the picklist. The picklist can be set up to display automatically when a field fails validation. The picklist can be displayed to select a valid field entry at any time the focus is on the field and before the VPM Enterprise validation function is run.

Tip: See the Building Data: Picklist Help chapter to learn how to set up and control VPM’s Picklist Help.

Combo Box Help: The picklist can also be displayed using a combobox control.

PostValidation Code: After a field passes validation, any "PostValidation Code" you have entered for the field is run. PostValidation Code is a VPME-provided feature in the Data Builder that allows you to enter code to apply additional validation rules to a field or to update or calculate values for other fields using the new field value. See Field-Level Data-Driven Developer Code.

Set Up Field Validation First: While you can set up and modify field validation rules in the Data Builder at any time, it’s much better to set up field validation rules before you begin creating forms – particularly, for fields that will use the Referential validation type. Referential validation affects the selection of the control placed on a form for a field. Referential validation also defines how the tables in an application are related, which is important information used by VPME to make Related Forms and certain form classes work properly. See Referential Validation.

More:

Setting Up Field Validation