17. Forms Statements : set_frs Statement--Set FRS Features : Setting Global Field and Column Validations
 
Share this page                  
Setting Global Field and Column Validations
The validate constant is used to turn the various mechanisms for field and table field column validation checks on and off. (The validation checks themselves are specified for the fields and columns at the time the form is defined in VIFRED.) It sets these validations for the application as a whole, rather than for merely a single form object; therefore, it requires the frs object type. The syntax for this particular variant of the set_frs statement is:
set_frs frs
    (validate(validation_name) = value
    {, validate(validation_name) = value})
The validation_name describes the type of validation mechanism being set. Value must be either 1 or 0, or the name of an integer variable with the value 1 or 0. The value 1 turns the validation mechanism on; 0 turns it off. The validation_names, their default values and the type of validation mechanism that each controls are listed in the following table:
Validation Name
Default Value
Type of Validation
keys
0 (off)
Pressing any control/function/arrow key mapped to an FRS key.
menu
0 (off)
Pressing the Menu Key.
menuitem
0 (off)
Selecting any menu item (or function/ control/arrow key) mapped to a menu item.
nextfield
1 (on)
Moving to the next field or column.
previousfield
0 (off)
Moving to the previous field or column.
These validations have a global effect. For example, the statement
exec frs set_frs frs (validate(keys) = 1);
causes a validation to be performed for the current field whenever any control, function, or arrow key mapped to an FRS key is pressed. Field validations, once set, apply to every form in the application (that is, they are global to the application).
The following statement turns on all possible field and column validations for every form in the application:
exec frs set_frs frs ( validate(nextfield) = 1,
                        validate(previousfield) = 1,
                        validate(menu) = 1,
                        validate(keys) = 1,
                        validate(menuitem) = 1 ) ;
The above is often issued right after the exec frs forms statement.