Input Masking with Format Templates
In data entry fields, you can optionally use input masking in conjunction with format templates to ensure that the user always enters valid characters in the correct order and position. The format template determines whether a character is valid; what is valid in one template may be invalid in another.
Without input masking, the validity of the user's entry is checked when the user attempts to leave the field. However, if input masking has been turned on for that field and its display format is a format template, the validity of the input is checked as the user enters the data, character by character. The input template is made up of special character codes that indicate what kind of input is allowed for that position in the template. If the user enters an invalid character for that position, the system beeps and requires the user to make a correct entry before continuing. For input templates, data entry mode is overstrike only; insert mode is not allowed. The user can correct entries with the Backspace and Delete keys.
To turn on input masking, you specify a numeric, date, or string template as the display format and set the Input Masking attribute for the field to y (yes) on the VIFRED Attributes for Field frame.
When specifying format templates, you must enter an appropriate template for the data type of the corresponding column in the database table. For example, a numeric template is appropriate for a field corresponding to a column of data type smallint, integer, float, or money, but is not appropriate for a field corresponding to a column of date or character data. For date fields that represent a fixed date value, you must select an absolute date/time template. The following sections tell you how to specify a format template for numeric, date, and string fields, including input masking for data entry fields.