Data fields are used to display variable data and to allow the user to enter data. To define a data field, use the DTAFLD tag. Every data field must have an associated variable, which is specified on the required DATAVAR attribute. Like all variables used on the panel, the variable named on the DATAVAR attribute can be declared using the VARDCL tag.
Data fields support field prompts, which can be placed in front of or above the data field.
This panel contains examples of all three types of data fields:
Library Inventory
To add a book to the inventory, complete the fields below, and then press
Enter.
Title . . . . __________________________________________________
Author . . . . ____________________
Publisher . . SPOTH AND CRICK
Number of
pages . . . . _____
---------------------------------------------------------------------------
Today's date is . : 08-10-89
<!doctype dm system>
<varclass name=titlcls type='char 50'>
<varclass name=bookcls type='char 20'>
<varclass name=pagecls type='numeric 5'>
<varclass name=datecls type='char 8'>
<varlist>
<vardcl name=title varclass=titlcls>
<vardcl name=author varclass=bookcls>
<vardcl name=publish varclass=bookcls>
<vardcl name=pages varclass=pagecls>
<vardcl name=curdate varclass=datecls>
</varlist>
<panel name=dfdxmp1a>Library Inventory
<topinst>To add a book to the inventory, complete the fields below,
and then press Enter.
<area>
<dtafld datavar=title usage=in pmtwidth=14>Title
<dtafld datavar=author usage=in entwidth=20 pmtwidth=14>Author
<dtafld datavar=publish entwidth=20 pmtwidth=14>Publisher
<dtafld datavar=pages usage=in entwidth=5 pmtwidth=14>Number of pages
<divider type=solid gutter=3 gap=no>
<dtafld datavar=curdate usage=out entwidth=8 pmtwidth=20>Today's date is
</area>
</panel>
In the previous example, there are three input-only data fields, an input/output data field, and an output-only data field. The value of the associated variable is not displayed in an input-only data field, so when the panel is initially displayed, the Title, Author, and Number of pages fields are blank. The Publisher data field assumes the default, BOTH, so the current value of the associated variable, publish, is displayed in the data field when the panel is initially displayed. The output-only data field is used to display the current date. The user cannot interact with this data field, since it is used only to display variable data. The user can enter data into any of the data fields except the output-only field.