Form items / Form fields |
FORMONLY form fields define their data type explicitly, with or without referencing a database columns.
item-type item-tag = FORMONLY.field-name [ TYPE { LIKE [table.]column | data-type [NOT NULL] } ] [ , attribute-list ] ;
item-type FORMONLY.field-name [ TYPE { LIKE [table.]column | data-type [NOT NULL] } ] [ , attribute-list ] ;
where data-type is one of:
{ CHAR | DECIMAL [(p[,s])] | SMALLFLOAT | REAL | FLOAT | MONEY [(p[,s])] | INTEGER | SMALLINT | DATE | VARCHAR | TEXT | BYTE | INTERVAL interval-qualifier | DATETIME datetime-qualifier | BIGINT | BOOLEAN }
Form fields can be specified with the FORMONLY prefix, when there is no corresponding database column, or when the field must be defined with another name as the database column.
When using the LIKE [table.]column syntax, the form field will get the data type of the specific table column as defined in the database schema. The table name must be specified in the TABLES section.
When using the TYPE data-type clause, you explicitly specify the type of the field. Note that for CHAR/VARCHAR data types, the size is defined by the item tag length in the layout.
If no data type is specified, and no database column is referenced, the default data type is CHAR.
Specifying a data type followed by the NOT NULL keywords is equivalent to the NOT NULL attribute.
The STRING data type is not supported in formonly form field definitions.
The definition of FORMONLY fields can be completed by using the DISPLAY LIKE and VALIDATE LIKE attributes, to get the display and validation attributes from the .att and .val database schema files.
Grid-based container FORMONLY form field definition (in the ATTRIBUTES section):
LAYOUT GRID { [f001 ] [f002 ] ... } END END ATTRIBUTES EDIT f001 = FORMONLY.total TYPE DECIMAL(10,2), NOENTRY ; EDIT f002 = FORMONLY.name TYPE LIKE customer.cust_name, VALIDATE LIKE customer.cust_name ;
Stack-based container FORMONLY form field definition:
LAYOUT STACK GROUP EDIT FORMONLY.total TYPE DECIMAL(10,2), NOENTRY ; EDIT FORMONLY.name TYPE LIKE customer.cust_name, REQUIRED;