field_val

Executes the active window's field validation triggers.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X      

Syntax

int field_val(msgbuf,[[name | number] | [attribute,flag]])
string        msgbuf,name
int           attribute,number,flag

Description

Returns -1 if valid. Otherwise, the function returns the field sequence number of the first invalid field in the set of matching fields.
msgbuf contains the error message returned by error, if one exists.

name (optional) specifies a field validation trigger by name.

number (optional) specifies a field validation trigger by number. It must evaluate to a valid field sequence number.

attribute (optional) specifies a bitmask.

flag = true (optional) specifies that the validation triggers are executed for all fields that have any user attributes that match the bitmask; otherwise, the validation triggers are executed for all fields that do not have any of the user attributes.

Notes

The window-name.AF is preserved across field_exec(). Any changes to the active field in the field trigger are not preserved.

Example

Validates all fields and moves cursor to the field containing an error:
{
int fnum;
fnum = field_val(g.msg);
if (fnum != -1) active_field(fnum);
}