Form items / Form fields |
Form fields defined with a table and column name get data type from the database schema file.
item-type item-tag = [table.]column [ , attribute-list ] ;
item-type [table.]column [ , attribute-list ] ;
A form field is typically based on the definition of a database column found in the database schema specified with the SCHEMA clause at the beginning of the form file. The database column defines the data type of the form field.
In order to reference database columns, the table name must be listed in the TABLES section of the form.
The programs only have access to screen record fields, in order to display or input data using program variables. Regardless of how you define them, there is no implicit relationship between the values of program variables, form fields, and database columns. Even, for example, if you declare a variable lname LIKE customer.lname, the changes that you make to the variable do not imply any change in the column value. Functional relationships among these entities must be specified in the program code, through screen interaction statements, and through SQL statements. It is up to the programmer to determine what data a form displays and what to do with data values that the user enters into the fields of a form. You must indicate the binding explicitly in any statement that connects variables to forms or to database columns.
If a form field is declared with a table column using the SERIAL, SERIAL8 or BIGSERIAL SQL type, the field will automatically get the NOENTRY attribute, except if the field is defined with the TYPE LIKE syntax.
Grid-based container database form field definition:
SCHEMA stores -- Database schema LAYOUT GRID { [f001 ] ... } END END TABLES customer -- Database table END ATTRIBUTES EDIT f001 = customer.fname, -- DB-col form field REQUIRED, COMMENTS="Customer name"; ...
SCHEMA stores -- Database schema TABLES customer -- Database table END LAYOUT STACK GROUP EDIT customer.fname, -- DB-col form field REQUIRED, COMMENTS="Customer name"; ...