Contact | Privacy | Datenschutzerklärung | Impressum

dba Part 4: The FORM View

The FORM View is the heart of a dba application, for this is where new records are entered into the database, and existing records can be displayed or modified.

Users will Browse through the database in Table View, displaying a pre-determined number of records per page, as previously explained in part 3 of this tutorial. When the User wishes to see more detailed information about individual records, however, that record is displayed on a page by itself in FORM View.

The main Tag in this section is the <dbaForm> Tag. This is an Environment Tag, inside of which a layout is specified both for data entry and display purposes.

A simplified dba FORM is defined as follows:

<dbaForm gb r keyact="upd">
  <TABLE>
    // Define FORM Data Fields here.
 </TABLE>
</dbaForm>

What happens inside the <dbaForm> Environment depends on the nature and type of Data Fields to be entered or displayed. In part 3 we briefly mentioned that there are a large number of Data Field Display Tags you can use to define a FORM. Each Tag is designed to handle a specific situation. Here are the Tags to be explained in this section:

For Generic Data Fields:

  • < dbafi app fieldname size maxsize def />

  • < dbaTfi app fieldname size maxsize />

  • < dbaTab app fieldname size maxsize />

For Special Purpose Data Fields:

  • < dbaMailto app fieldname size maxsize def />

  • < dbaLink app fieldname size maxsize def />

  • < dbafiPassword app size pref="Password:" />

  • < dbaCheckBox app fieldname > Message </dbaCheckBox>

  • < dbaSelect app fieldname >

    < dbaOption app value />

    < dbaOptionV app value />

    </dbaSelect>

  • < dbaTextArea app fieldname cols rows disp />

Here is how a dba FORM might look using the generic Tags:

<dbaForm gb r keyact="upd">
  <TABLE>
    <tr>
      <td> 1st Name: </td>
      <td><dbafi gb "FirstName" 15 ></td>
    </tr>
    <dbaTfi gb "LastName" 20 30>
    <tr>
      <td> City: </td>
      <dbaTab gb "City" 20 30>
    </tr>
  <TABLE>
</dbaForm>

The differences in these Tags are fairly subtle. The <dbafi> Tag requires the most work, but gives you the most control over the display. You have to open and close the HTML Table Row <tr> and Table Data <td> Tags yourself, but in so doing, you can specify the exact appearance of the label in front of the Data Entry Field. You can even substitute the HTML Table Heading <th> Tag in place of the <td> Tag, or add your own complex formatting options around the label such as font size and text color.

Note that we have specified 15 as the number of characters which can be entered into this field. If the Data Field is larger than 15, but you want to minimize the size of your Browser window, you can use the maxsize parameter to allow more characters to be entered. For instance, specifying size=15 and maxsize=30 would show a data entry field 15 characters wide that will scroll to accommodate any extra characters that are entered. You should make sure that the number you specify in the maxsize parameter does not exceed the number of characters permitted in the SQL Table for this Data Field.

You can also specify a default parameter, usually def="&nbsp;" to display a blank space in the form if the data field is empty. The def parameter only comes into play in "display" mode. In other words, this parameter has no effect when entering or editing data, but when a User browses through a Database in Table View and wishes to see the details of a particular record in Form View, the def parameter insures that a blank field will be displayed if a Data Field is empty (i.e. it contains a null value). Using this parameter ensures that your HTML Tables will have a uniform look.

With the <dbaTfi> Tag, opening and closing of the HTML Table Row <tr> and the Table Data <td> Tags are handled for you. In doing so, it prints a row with the name of the Data Field in the first column, and creates a second column for the actual data to be entered. By using this Tag, you lose formatting control over the Data Field label, since, by default, it uses the SQL Field Name as the label. Normally, however, this will suffice, unless the Field Name is something like "xx1", which tells the User nothing about the kind of data that is expected to be entered.

The <dbaTab> Tag is similar to the <dbafi> Tag, except that the input field is placed together in a single column using the HTML <td> Tag.

The remaining Data Field Display Tags take over the functions of HTML Tags you should already be familiar with.

The <dbaMailto> Tag is similar to the <dbafi> Tag in that it has the same parameters and, when using it inside of an HTML Table, it requires you to open and close the Table Row <tr> and Table Data <td> Tags yourself. When entering or editing data into a field of this type, it looks exactly the same onscreen as the <dbafi> Tag. In "display" mode, however, the data is displayed as a Mailto hotlink, which means that clicking on this link will automatically open an email window so that you can compose a message. Obviously, this means that only email addresses should entered into a data field that uses this Tag.

The <dbaLink> Tag is also similar to the <dbafi> Tag, except that it creates a hotlink to a Web Page URL in "display" mode. In this respect, the <dbaLink> Tag functions like an HTML <INPUT> Tag when data is being entered or edited, but functions like the HTML <a href=...> anchor Tag when viewing a record in display mode.

The <dbafiPassword> Tag can only be used if the SQL Table contains a data field called Password as part of its field definition. Using this Tag ensures that a User can type his password into a form without worrying about someone looking over his shoulder and seeing it. As expected, the "*" symbol appears on the screen for each character that is entered. The characters are then encrypted using the crypt() function (UNIX systems only) before it is inserted into the SQL Table or compared to the data that was previously stored in the Password field.

The <dbaCheckBox> Tag creates an HTML Checkbox. Here is an example of how to use it within a Table:

<dbaForm gb r keyact="upd">
  <TABLE>
   <tr> <td>
     <dbaCheckBox gb "Programmer">
       Are you a Programmer?:
     </dbaCheckBox>
   </td> </tr>
  </TABLE>
</dbaForm> 

As you can see, it is similar to the <dbafi> Tag in that it requires you to open and close the HTML Table Row <tr> and Table Data <td> Tags yourself. It is also an Environment Tag, which means that you can display meaningful messages in front of the on-screen checkbox.

Any number of checkboxes can be displayed within a single row, and even within the same data column, if you so choose. How you format your FORM is strictly up to you.

The <dbaSelect> Tag is an Environment Tag that mimics the function of the HTML <select> Tag. This means that it can only be used in conjunction with the <dbaOption> and <dbaOptionV> Tags, which mimic the standard function of the corresponding HTML Tags.

The final Data Field Display Tag takes the place of the HTML <textarea> Tag. This <dbaTextArea> Tag is normally used for SQL Data fields that store a large amount of data. In addition to the usual app and fieldname parameters, you must specify the size of the box where text is entered. You do this using the cols and rows parameters. Optionally, you can also use the disp parameter to tell heitml how the data should be presented in display mode. This parameter can be disp="pre" or disp="html".

Note: Some SQL Database programs do not handle the text data type and can only handle data fields of up to 250 characters. Other full-fledged SQL programs treat text as a Character Large Object (or CLOB) or a Binary Large Object (or BLOB) and can handle megabytes of data in a single data field of this type. You should check the User Manual of your particular SQL Database program to determine how it handles large text data fields.

Summary

This section explained how a dba Application operates in Form View. The Form View is used to enter and edit data into an SQL Table, and to display the contents of individual records.

We discussed each of the Data Field Display Tags that are used to create onscreen data-entry forms, and we presented examples of when and how to use them.

This concludes the dba Tutorial. You now have a basic understanding of how to construct dba Applications on your own. At this point in time you should study the code in the Guestbook Template and make a few simple modifications. After that, you might want to proceed to the Tips and Tricks section for more advanced information.


This page was dynamically generated by the web application development tool RADpage of H.E.I. See "Was ist AJAX? " (in German). In Germany H.E.I. provides Webdesign in Mannheim and Web Programming (Programmierung).
© 1996-2024 H.E.I. All Rights Reserved.



Homepage
Intro/Features
Component Guide
Programming
  Language Guide
  Language Ref.
  Component Ref.
  Class Library
  User Components
  Tutorial
  New Features
  heitml 1
    dba Tutorial
      dba Part 1
      dba Part 2
      dba Part 3
      dba Part 4
    dbq Tutorial
    dbs Tutorial
    The heitml Libraries
    Demonstration
User Guide
Services
Privacy
Datenschutz
 
Contact / Impressum